1000
|
It is possible to search for an item ( inside the Editor ), case insensitive

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oEditor
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oEditor := oGrid:Columns():Add("DropDownList"):Editor()
oEditor:EditType := 3/*DropDownListType*/
oEditor:AddItem(1,"One")
oEditor:AddItem(2,"Two")
oEditor:AddItem(3,"Three")
oItems := oGrid:Items()
oItems:AddItem(oGrid:Columns:Item(0):Editor():FindItem(">ONE"))
oItems:AddItem(oGrid:Columns:Item(0):Editor():FindItem(">ThRee"))
oItems:AddItem(oGrid:Columns:Item(0):Editor():FindItem("ONE"))
oItems:AddItem(oGrid:Columns:Item(0):Editor():FindItem(">tWo"))
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
999
|
The text after the BR-tag is in same line as the text before the BR-tag (entire column)

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:DrawGridLines := 1/*exHLines*/
oColumn := oGrid:Columns():Add("Default")
oColumn:SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn:SetProperty("Def",16/*exCellSingleLine*/,.F.)
oItems := oGrid:Items()
oItems:AddItem("This is the first line.<br>This is the second line.")
oItems:AddItem("This is the first line.<br>This is the second line.")
oItems:AddItem("This is the first line.<br>This is the second line.")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
998
|
The text after the BR-tag is in same line as the text before the BR-tag (individual)

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:DrawGridLines := 1/*exHLines*/
oGrid:Columns():Add("Default")
oItems := oGrid:Items()
oItems:SetProperty("CellValueFormat",oItems:AddItem("This is the first line.<br>This is the second line."),0,1/*exHTML*/)
h := oItems:AddItem("<b>This is the first line.<br>This is the second line.</b>")
oItems:SetProperty("CellValueFormat",h,0,1/*exHTML*/)
oItems:SetProperty("CellSingleLine",h,0,0/*exCaptionWordWrap*/)
oItems:SetProperty("CellValueFormat",oItems:AddItem("This is the first line.<br>This is the second line."),0,1/*exHTML*/)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
997
|
Can I disable an item once the user selects a new value into a different item

PROCEDURE OnChange(oGrid,Item,ColIndex,NewValue)
LOCAL oItems
oItems := oGrid:Items()
oItems:SetProperty("EnableItem",oItems:ItemByIndex(1),.F.)
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oEditor
LOCAL oItems
LOCAL h1,h2
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:Change := {|Item,ColIndex,NewValue| OnChange(oGrid,Item,ColIndex,NewValue)} /*Occurs when the user changes the cell's content.*/
oGrid:FreezeEvents(.T.)
oGrid:BeginUpdate()
oGrid:ScrollBySingleLine := .T.
oGrid:DrawGridLines := -2/*exRowLines*/
oGrid:Columns():Add("Q")
oGrid:Columns():Add("A")
oItems := oGrid:Items()
h1 := oItems:AddItem("What's your gender?")
oEditor := oItems:CellEditor(h1,1)
oEditor:EditType := 3/*DropDownListType*/
oEditor:AddItem(1,"Male")
oEditor:AddItem(0,"Female")
oItems:SetProperty("CellValue",h1,1,1)
h2 := oItems:AddItem("What's pet name?")
oItems:SetProperty("CellValue",h2,1,"This is my pet favorite long long long name, that shoul break the line in multiple pieces")
oItems:SetProperty("CellSingleLine",h2,1,0/*exCaptionWordWrap*/)
oGrid:EndUpdate()
oGrid:FreezeEvents(.F.)
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
996
|
How can I get a row expanded / enlarged to fit the cell's text (entire column)

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oEditor
LOCAL oItems
LOCAL h1,h2
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ScrollBySingleLine := .T.
oGrid:DrawGridLines := -2/*exRowLines*/
oGrid:Columns():Add("Q")
oColumn := oGrid:Columns():Add("A")
oColumn:SetProperty("Def",16/*exCellSingleLine*/,.F.)
oEditor := oColumn:Editor()
oEditor:EditType := 5/*MemoType*/
oEditor:Appearance := 8/*SingleApp*/
oItems := oGrid:Items()
h1 := oItems:AddItem("What's name?")
oItems:SetProperty("CellValue",h1,1,"This is my pet favorite long long long name, that shoul break the line in multiple pieces")
h2 := oItems:AddItem("What's your pet name?")
oItems:SetProperty("CellValue",h2,1,"This is my pet favorite long long long name, that shoul break the line in multiple pieces")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
995
|
How can I get a row expanded / enlarged to fit the cell's text (individual cell)

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oEditor
LOCAL oItems
LOCAL h1,h2
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ScrollBySingleLine := .T.
oGrid:DrawGridLines := -2/*exRowLines*/
oGrid:Columns():Add("Q")
oGrid:Columns():Add("A")
oItems := oGrid:Items()
h1 := oItems:AddItem("What's name?")
oItems:SetProperty("CellValue",h1,1,"This is my pet favorite long long long name, that shoul break the line in multiple pieces")
h2 := oItems:AddItem("What's your pet name?")
oEditor := oItems:CellEditor(h2,1)
oEditor:EditType := 5/*MemoType*/
oEditor:Appearance := 8/*SingleApp*/
oItems:SetProperty("CellValue",h2,1,"This is my pet favorite long long long name, that shoul break the line in multiple pieces")
oItems:SetProperty("CellSingleLine",h2,1,0/*exCaptionWordWrap*/)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
994
|
InsertControlItem / UserEditor / A2X:

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h,hX
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 240,240,240 } ) , .F. ))
oGrid:ConditionalFormats():Add("1 = 1"):Bold := .T.
oGrid:Columns():Add("Type"):Alignment := 2/*RightAlignment*/
oItems := oGrid:Items()
h := oItems:AddItem("1. A ProgID such as " + CHR(34) + "MSCAL.Calendar.7" + CHR(34) + "")
oItems:SetProperty("ItemDivider",h,0)
hX := oItems:InsertControlItem(0,"MSCAL.Calendar","")
oItems:ItemObject(hX):SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 255,255,255 } ) , .F. ))
h := oItems:AddItem("2. A CLSID such as " + CHR(34) + "{0036F83C-D892-4B7B-AA0B-BEDD8D16A738}" + CHR(34) + "")
oItems:SetProperty("ItemDivider",h,0)
hX := oItems:InsertControlItem(0,"{0036F83C-D892-4B7B-AA0B-BEDD8D16A738}","")
h := oItems:AddItem("3. A URL such as " + CHR(34) + "http://www.exontrol.com" + CHR(34) + "")
oItems:SetProperty("ItemDivider",h,0)
hX := oItems:InsertControlItem(0,"http://www.exontrol.com","")
h := oItems:AddItem("4. A reference to an Active document such as " + CHR(34) + "file://\\Documents\MyDoc.doc" + CHR(34) + "")
oItems:SetProperty("ItemDivider",h,0)
hX := oItems:InsertControlItem(0,"file://C:\empesting.xml","")
h := oItems:AddItem("5.A fragment of HTML such as " + CHR(34) + "MSHTML:<HTML><BODY>This is a line of text</BODY></HTML>" + CHR(34) + "")
oItems:SetProperty("ItemDivider",h,0)
hX := oItems:InsertControlItem(0,"MSHTML:<HTML><BODY>This is a <b>line of</b> text</BODY></HTML>","")
oItems:SetProperty("ItemHeight",hX,56)
h := oItems:AddItem("6.Anything, if it is preffixed by " + CHR(34) + "A2X:" + CHR(34) + "")
oItems:SetProperty("ItemDivider",h,0)
hX := oItems:InsertControlItem(0,"A2X:TOC24.Toc24Ctrl.1","")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
993
|
How do I add a RichTextBox editor
PROCEDURE OnUserEditorOleEvent(oGrid,Object,Ev,CloseEditor,Item,ColIndex)
DevOut( Transform(Ev,"") )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oEditor
LOCAL oItems
LOCAL oRichTextBox
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:UserEditorOleEvent := {|Object,Ev,CloseEditor,Item,ColIndex| OnUserEditorOleEvent(oGrid,Object,Ev,CloseEditor,Item,ColIndex)} /*Occurs when an user editor fires an event.*/
oGrid:BeginUpdate()
oGrid:DrawGridLines := -1/*exAllLines*/
oGrid:DefaultItemHeight := 32
oEditor := oGrid:Columns():Add("RICHTEXT"):Editor()
oEditor:EditType := 16/*UserEditorType*/
oEditor:UserEditor("RICHTEXT.RichtextCtrl","")
oRichTextBox := oEditor:UserEditorObject()
oRichTextBox:AutoVerbMenu := .T.
oRichTextBox:TextRTF := "{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard\r\nThis is some {\b bold} text.\par\r\n}"
oItems := oGrid:Items()
oItems:AddItem("RICHTEXT.RichtextCtrl")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
992
|
Is it possible to trap a double-click event on a specific cell and when that happens, to set the cell to a specific value
PROCEDURE OnDblClick(oGrid,Shift,X,Y)
LOCAL h
h := oGrid:ItemFromPoint(-1,-1,c,hit)
DevOut( Transform(oGrid:Items:CellValue(h,c),"") )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:DblClick := {|Shift,X,Y| OnDblClick(oGrid,Shift,X,Y)} /*Occurs when the user dblclk the left mouse button over an object.*/
oGrid:BeginUpdate()
oGrid:HeaderAppearance := 4/*Etched*/
oGrid:DrawGridLines := -2/*exRowLines*/
oGrid:Columns():Add("C1")
oGrid:Columns():Add("C2")
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem("Item 1"),1,"Item 2")
oItems:SetProperty("CellValue",oItems:AddItem("Item 3"),1,"Item 4")
oItems:SetProperty("CellValue",oItems:AddItem("Item 5"),1,"Item 6")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
991
|
How can I display dates in DD/MM/YYYY format

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ScrollBySingleLine := .F.
oGrid:Columns():Add("Date")
oItems := oGrid:Items()
oItems:SetProperty("ItemDivider",oItems:AddItem("Different Date Formats"),0)
oItems:SetProperty("FormatCell",oItems:AddItem("12/01/1971"),0,"((shortdateF(value) mid 4) left 2) + `/` + (shortdateF (value) left 2) + `/` + (shortdateF (value) right 4)")
oItems:SetProperty("FormatCell",oItems:AddItem("12/01/1971"),0,"(1 array (0:=(shortdateF(value) split `/`))) + `/` + (0 array (=:0) ) + `/` + (2 array (=:0) )")
oItems:SetProperty("FormatCell",oItems:AddItem("12/01/1971"),0,"((`0` + day(value) ) right 2) + `/` + ((`0` + month(value) ) right 2) + `/` + year(value)")
oItems:SetProperty("FormatCell",oItems:AddItem("12/01/1971"),0,"day(value) + `/` + month(value) + `/` + year(value)")
oItems:SetProperty("FormatCell",oItems:AddItem("12/01/1971"),0,"year(value) + ` - ` + day(value) + ` - ` + month(value)")
h := oItems:AddItem("12/01/1971")
oItems:SetProperty("ItemHeight",h,24)
oItems:SetProperty("CellValueFormat",h,0,1/*exHTML*/)
oItems:SetProperty("FormatCell",h,0,"`<b>` + year(value) + `</b><off -4> ` + day(value) + ` - ` + month(value)")
oItems:SetProperty("ItemDivider",oItems:AddItem("Predefined Date Formats"),0)
oItems:SetProperty("FormatCell",oItems:AddItem("12/01/1971"),0,"value")
oItems:SetProperty("FormatCell",oItems:AddItem("12/01/1971"),0,"shortdateF(value)")
oItems:SetProperty("FormatCell",oItems:AddItem("12/01/1971"),0,"shortdate(value)")
oItems:SetProperty("FormatCell",oItems:AddItem("12/01/1971"),0,"longdate(value)")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
990
|
I have noticed that the column gets resized once I release the mouse. I have a column that displays multiple-lines cells, and the text gets wrapped only when user releases the mouse. Is it possible to get resized contiguously as I had before
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ScrollBySingleLine := .F.
oGrid:DrawGridLines := 2/*exVLines*/
oGrid:ColumnsAllowSizing := .T.
oGrid:Columns():Add("Column A (cont)"):SetProperty("Def",64/*exColumnResizeContiguously*/,.T.)
oGrid:Columns():Add("Column 1")
oGrid:Columns():Add("Column B (cont)"):SetProperty("Def",64/*exColumnResizeContiguously*/,.T.)
oGrid:Columns():Add("Column 2")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
989
|
How do I get the column from cursor, when it hovers the empty portion of the items section
PROCEDURE OnMouseMove(oGrid,Button,Shift,X,Y)
LOCAL i
i := oGrid:ItemFromPoint(0,-1,c,hit)
DevOut( "Column" )
DevOut( Transform(c,"") )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:MouseMove := {|Button,Shift,X,Y| OnMouseMove(oGrid,Button,Shift,X,Y)} /*Occurs when the user moves the mouse.*/
oGrid:BeginUpdate()
oGrid:DrawGridLines := 2/*exVLines*/
oGrid:Columns():Add("Column 0")
oGrid:Columns():Add("Column 1")
oGrid:Columns():Add("Column 2")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
988
|
How do I add items once the user clicks the empty area
PROCEDURE OnClick(oGrid)
LOCAL oItems
LOCAL i
i := oGrid:ItemFromPoint(0,-1,c,hit)
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem(i),1,c)
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:Click := {|| OnClick(oGrid)} /*Occurs when the user presses and then releases the left mouse button over the grid control.*/
oGrid:BeginUpdate()
oGrid:Columns():Add("Number of Items to Add")
oGrid:Columns():Add("Click on Column")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
987
|
Is there any option to stop events
PROCEDURE OnAddItem(oGrid,Item)
DevOut( "AddItem event is fired only if FreezeEvents(False) is called" )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h1,h2
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:AddItem := {|Item| OnAddItem(oGrid,Item)} /*Occurs after a new Item has been inserted to Items collection.*/
oGrid:FreezeEvents(.T.)
oGrid:BeginUpdate()
oGrid:DefaultItemHeight := 24
oGrid:Columns():Add("Task")
oItems := oGrid:Items()
h1 := oItems:AddItem("Task 1")
h2 := oItems:AddItem("Task 2")
oGrid:EndUpdate()
oGrid:FreezeEvents(.F.)
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
986
|
How can I include the child items, when a filter is applied

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h0
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:Indent := 16
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oGrid:FilterBarPromptPattern := "Nancy"
oGrid:FilterInclude := 1/*exItemsWithChilds*/
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oItems := oGrid:Items()
h0 := oItems:AddItem("Nancy Davolio")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:InsertItem(h0,,"Andrew Fuller")
oItems:SetProperty("CellValue",h0,1,"Vice President, Sales")
oItems:SetProperty("CellValue",h0,2,"Tacoma")
h0 := oItems:InsertItem(h0,,"Michael Suyama")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Janet Leverling")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Kirkland")
h0 := oItems:InsertItem(h0,,"Margaret Peacock")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Redmond")
oItems:SetProperty("ExpandItem",0,.T.)
oGrid:ApplyFilter()
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
985
|
How do I prevent changing the cell's state ( check-box state )
PROCEDURE OnCellStateChanging(oGrid,Item,ColIndex,NewState)
LOCAL oItems
oItems := oGrid:Items()
NewState := oItems:CellState(Item,ColIndex)
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:CellStateChanging := {|Item,ColIndex,NewState| OnCellStateChanging(oGrid,Item,ColIndex,NewState)} /*Fired before cell's state is about to be changed.*/
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oColumn := oGrid:Columns():Add("P1")
oColumn:SetProperty("Def",0/*exCellHasCheckBox*/,.T.)
oColumn:PartialCheck := .T.
oColumn1 := oGrid:Columns():Add("P2")
oColumn1:SetProperty("Def",0/*exCellHasCheckBox*/,.T.)
oColumn1:PartialCheck := .T.
oItems := oGrid:Items()
h := oItems:AddItem("Root")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("ExpandItem",h,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
984
|
How do I get sorted the column as string, numeric, date, date and time. Also how can it be applied to drop down filter panel

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1,oColumn2,oColumn3,oColumn4
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oColumn := oGrid:Columns():Add("Date")
oColumn:SortType := 2/*SortDate*/
oColumn:DisplayFilterButton := .T.
oColumn:DisplayFilterPattern := .F.
oColumn:DisplayFilterDate := .T.
oColumn:FilterList := 1296/*exShowFocusItem+exShowCheckBox+exSortItemsDesc*/
oColumn1 := oGrid:Columns():Add("DateTime")
oColumn1:SortType := 3/*SortDateTime*/
oColumn1:DisplayFilterButton := .T.
oColumn1:DisplayFilterPattern := .F.
oColumn1:FilterList := 1296/*exShowFocusItem+exShowCheckBox+exSortItemsDesc*/
oColumn2 := oGrid:Columns():Add("Time")
oColumn2:SortType := 4/*SortTime*/
oColumn2:DisplayFilterButton := .T.
oColumn2:DisplayFilterPattern := .F.
oColumn2:FilterList := 1296/*exShowFocusItem+exShowCheckBox+exSortItemsDesc*/
oColumn2:FormatColumn := "time(value)"
oColumn3 := oGrid:Columns():Add("Numeric")
oColumn3:SortType := 1/*SortNumeric*/
oColumn3:DisplayFilterButton := .T.
oColumn3:FilterList := 1296/*exShowFocusItem+exShowCheckBox+exSortItemsDesc*/
oColumn4 := oGrid:Columns():Add("String")
oColumn4:DisplayFilterButton := .T.
oColumn4:FilterList := 1296/*exShowFocusItem+exShowCheckBox+exSortItemsDesc*/
oItems := oGrid:Items()
h := oItems:AddItem("01/27/2010")
oItems:SetProperty("CellValue",h,1,"01/27/2010 10:00:00")
oItems:SetProperty("CellValue",h,2,oItems:CellValue(h,1))
oItems:SetProperty("CellValue",h,3,1)
oItems:SetProperty("CellValue",h,4,oItems:CellValue(h,3))
h := oItems:AddItem("01/27/2011")
oItems:SetProperty("CellValue",h,1,"01/27/2011 09:00:00")
oItems:SetProperty("CellValue",h,2,oItems:CellValue(h,1))
oItems:SetProperty("CellValue",h,3,11)
oItems:SetProperty("CellValue",h,4,oItems:CellValue(h,3))
h := oItems:AddItem("11/02/2010")
oItems:SetProperty("CellValue",h,1,"11/02/2010 09:00:00")
oItems:SetProperty("CellValue",h,2,oItems:CellValue(h,1))
oItems:SetProperty("CellValue",h,3,2)
oItems:SetProperty("CellValue",h,4,oItems:CellValue(h,3))
oGrid:Columns:Item("DateTime"):DisplayFilterDate := .F.
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
983
|
I am using Layout property to sort multiple columns at once. The problem is that all items get expanded. How do I prevent that

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oColumn := oGrid:Columns():Add("P1")
oColumn:SetProperty("Def",0/*exCellHasCheckBox*/,.T.)
oColumn:PartialCheck := .T.
oColumn1 := oGrid:Columns():Add("P2")
oColumn1:SetProperty("Def",0/*exCellHasCheckBox*/,.T.)
oColumn1:PartialCheck := .T.
oColumn1:FormatColumn := "1 index ``"
oItems := oGrid:Items()
h := oItems:AddItem("Root")
oItems:InsertItem(h,,"Child A")
oItems:InsertItem(h,,"Child B")
oItems:InsertItem(h,,"Child A")
oItems:InsertItem(h,,"Child B")
oItems:AddItem("Root")
oItems:AddItem("Root")
oGrid:SingleSort := .F.
oGrid:Layout := "multiplesort=" + CHR(34) + "C0:1 C1:2" + CHR(34) + ";collapse=" + CHR(34) + "" + CHR(34) + ""
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
982
|
How do I find the cell's type, or what the cell holds

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:DrawGridLines := -2/*exRowLines*/
oColumns := oGrid:Columns()
oColumns:Add("Value"):Width := 24
oColumns:Add("Type"):FormatColumn := "type(%0)"
oColumns:Add("TypeAsString"):FormatColumn := "(0 := type(%0)) array (`empty`, `null`, `short`, `long`, `float`, `double`, `currency`, `date`, `string`, `object`, `error`, `boolean`, `variant`, `any`, `reserved`, `decimal`, `char`, `byte`, `unsigned short`, `unsigned long`, `long on 64 bits`)"
oColumns:Add("Length"):FormatColumn := "len(%0)"
oItems := oGrid:Items()
oItems:AddItem()
oItems:AddItem("")
oItems:SetProperty("CellValue",:AddItem(),0,oGrid)
oItems:SetProperty("CellValue",oItems:AddItem(),0,.T.)
oItems:SetProperty("CellValue",oItems:AddItem(),0,-1)
oItems:SetProperty("CellValue",oItems:AddItem(),0,-1)
oItems:SetProperty("CellValue",oItems:AddItem(),0,"01/01/2001")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
981
|
How can I get ride / hide the image being dragged by OLE Drag and Drop
PROCEDURE OnOLEStartDrag(oGrid,Data,AllowedEffects)
/*Data.SetData("data to drag")*/
AllowedEffects := 1
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:OLEStartDrag := {|Data,AllowedEffects| OnOLEStartDrag(oGrid,Data,AllowedEffects)} /*Occurs when the OLEDrag method is called.*/
oGrid:OLEDropMode := 1/*exOLEDropManual*/
oGrid:SetProperty("Background",34/*exDragDropAfter*/,AutomationTranslateColor( GraMakeRGBColor ( { 255,255,255 } ) , .F. ))
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:Columns():Add("Default")
oItems := oGrid:Items()
h := oItems:AddItem("Root")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("ExpandItem",h,.T.)
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
980
|
The ReadOnly property does not prevent changing the column's check-box (sample 2)

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ShowFocusRect := .F.
oColumn := oGrid:Columns():Add("C1")
oColumn:AllowSizing := .F.
oColumn:Width := 18
oColumn:Editor():EditType := 19/*CheckValueType*/
oGrid:Columns():Add("C2")
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem(0),1,"Item 1")
oItems:SetProperty("CellValue",oItems:AddItem(-1),1,"Item 2")
oItems:SetProperty("CellValue",oItems:AddItem(0),1,"Item 3")
oGrid:ReadOnly := -1/*exReadOnly*/
oGrid:Columns:Item(0):Editor():SetProperty("Option",17/*exCheckValue2*/,2)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
979
|
The ReadOnly property does not prevent changing the column's check-box (sample 1)

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oEditor
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ShowFocusRect := .F.
oColumn := oGrid:Columns():Add("C1")
oColumn:AllowSizing := .F.
oColumn:Width := 18
oEditor := oColumn:Editor()
oEditor:EditType := 19/*CheckValueType*/
oEditor:SetProperty("Option",17/*exCheckValue2*/,1)
oGrid:Columns():Add("C2")
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem(0),1,"Item 1")
oItems:SetProperty("CellValue",oItems:AddItem(-1),1,"Item 2")
oItems:SetProperty("CellValue",oItems:AddItem(0),1,"Item 3")
oGrid:ReadOnly := -1/*exReadOnly*/
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
978
|
How can I export checked items only

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oColumns := oGrid:Columns()
oColumns:Add("C1"):SetProperty("Def",0/*exCellHasCheckBox*/,.T.)
oColumns:Add("C2"):FormatColumn := "1 index `A-Z`"
oColumns:Add("C3"):FormatColumn := "100 index ``"
oItems := oGrid:Items()
oItems:AddItem("Item 1")
oItems:SetProperty("CellState",oItems:AddItem("Item 2"),1)
oItems:SetProperty("CellState",oItems:AddItem("Item 3"),1)
oGrid:EndUpdate()
DevOut( "Export CSV Checked Items Only:" )
DevOut( Transform(oGrid:Export("","chk"),"") )
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
977
|
How can I export a hidden column

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL oColumns
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oColumns := oGrid:Columns()
oColumns:Add("C1")
oColumn := oColumns:Add("C2")
oColumn:FormatColumn := "1 index `A-Z`"
oColumn:Visible := .F.
oColumn1 := oColumns:Add("C3")
oColumn1:FormatColumn := "100 index ``"
oColumn1:Visible := .F.
oItems := oGrid:Items()
oItems:AddItem("Item 1")
oItems:AddItem("Item 2")
oItems:AddItem("Item 3")
oGrid:EndUpdate()
DevOut( "Export CSV Hidden Columns (1,2):" )
DevOut( Transform(oGrid:Export("","|1,2"),"") )
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
976
|
I'm trying to use automatic numbering of the outline. How can I have A, B, C for root items, 1, 2, 3 for the sub-items, and a, b, c for sub-sub-items (sample 3)

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oColumns
LOCAL oItems
LOCAL h,hChild
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:DrawGridLines := -2/*exRowLines*/
oGrid:AutoDrag := 3/*exAutoDragPositionAny*/
oGrid:HasLines := 1/*exSolidLine*/
oGrid:Indent := 16
oGrid:MarkSearchColumn := .F.
oColumns := oGrid:Columns()
oColumn := oColumns:Add("")
oColumn:SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn:FormatColumn := "((1:=(0 :=(1 rpos '.|A-Z||a-z|')) rfind `.`) < 0 ? `<b>` + =:0 + `` : (=:0 mid (1 + 1 + =:1) ) + `)` ) + ` ` + value"
oItems := oGrid:Items()
h := oItems:AddItem("Root")
oItems:InsertItem(h,,"Child")
hChild := oItems:InsertItem(h,,"Child")
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(h,,"Child")
oItems:SetProperty("ExpandItem",0,.T.)
h := oItems:AddItem("Root")
oItems:InsertItem(h,,"Child")
hChild := oItems:InsertItem(h,,"Child")
oItems:SetProperty("CellState",hChild,0,1)
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(h,,"Child")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
975
|
I'm trying to use automatic numbering of the outline. How can I have A, B, C for root items, 1, 2, 3 for the sub-items, and a, b, c for sub-sub-items (sample 2)

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oColumns
LOCAL oItems
LOCAL h,hChild
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:SetProperty("GridLineColor",AutomationTranslateColor( GraMakeRGBColor ( { 190,190,190 } ) , .F. ))
oGrid:DrawGridLines := -2/*exRowLines*/
oGrid:AutoDrag := 3/*exAutoDragPositionAny*/
oGrid:HasLines := 1/*exSolidLine*/
oGrid:Indent := 16
oColumns := oGrid:Columns()
oColumns:Add("Default")
oColumn := oColumns:Add("")
oColumn:SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn:SetProperty("Def",49/*exCellPaddingRight*/,4)
oColumn:AllowSizing := .F.
oColumn:Width := 36
oColumn:Position := 0
oColumn:FormatColumn := "(1:=(0 :=(1 rpos '.|A-Z||a-z|')) rfind `.`) < 0 ? `<b>` + =:0 : (`............` left 2 * (=:0 count `.`)) + (=:0 mid (1 + 1 + =:1) ) "
oItems := oGrid:Items()
h := oItems:AddItem("Root")
oItems:InsertItem(h,,"Child")
hChild := oItems:InsertItem(h,,"Child")
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(h,,"Child")
oItems:SetProperty("ExpandItem",0,.T.)
h := oItems:AddItem("Root")
oItems:InsertItem(h,,"Child")
hChild := oItems:InsertItem(h,,"Child")
oItems:SetProperty("CellState",hChild,0,1)
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(h,,"Child")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
974
|
I'm trying to use automatic numbering of the outline. How can I have A, B, C for root items, 1, 2, 3 for the sub-items, and a, b, c for sub-sub-items (sample 1)

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oColumns
LOCAL oItems
LOCAL h,hChild
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:DrawGridLines := -2/*exRowLines*/
oGrid:AutoDrag := 3/*exAutoDragPositionAny*/
oGrid:HasLines := 1/*exSolidLine*/
oGrid:Indent := 16
oColumns := oGrid:Columns()
oColumns:Add("Default")
oColumn := oColumns:Add("")
oColumn:SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn:SetProperty("Def",49/*exCellPaddingRight*/,4)
oColumn:Alignment := 2/*RightAlignment*/
oColumn:AllowSizing := .F.
oColumn:Width := 24
oColumn:Position := 0
oColumn:FormatColumn := "(1:=(0 :=(1 rpos '.|A-Z||a-z|')) rfind `.`) < 0 ? `<b>` + =:0 : `<i>` + (=:0 mid (1 + 1 + =:1) ) "
oItems := oGrid:Items()
h := oItems:AddItem("Root")
oItems:InsertItem(h,,"Child")
hChild := oItems:InsertItem(h,,"Child")
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(h,,"Child")
oItems:SetProperty("ExpandItem",0,.T.)
h := oItems:AddItem("Root")
oItems:InsertItem(h,,"Child")
hChild := oItems:InsertItem(h,,"Child")
oItems:SetProperty("CellState",hChild,0,1)
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(hChild,,"Child")
oItems:InsertItem(h,,"Child")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
973
|
How can I programmatically group by columns, without having the control's sort bar visible

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:SortBarHeight := 0
oGrid:SortBarVisible := .T.
oGrid:SortBarCaption := "Drag a <b>column</b> header here to group by that column."
oGrid:AllowGroupBy := .T.
oGrid:Layout := "multiplesort=" + CHR(34) + "C1:2" + CHR(34) + ""
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
972
|
How do I perform my own sort

PROCEDURE OnSort(oGrid)
LOCAL oItems
DevOut( "Sort" )
oItems := oGrid:Items()
oItems:SetProperty("ItemPosition",oItems:ItemByIndex(1),0)
oItems:SetProperty("ItemPosition",oItems:ItemByIndex(0),1)
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:Sort := {|| OnSort(oGrid)} /*Fired when the control sorts a column.*/
oGrid:BeginUpdate()
oGrid:SingleSort := .F.
oGrid:SortOnClick := 1/*exUserSort*/
oColumns := oGrid:Columns()
oColumns:Add("Index"):FormatColumn := "0 index ``"
oColumns:Add("Data 1")
oColumns:Add("Data 2")
oItems := oGrid:Items()
h := oItems:AddItem(0)
oItems:SetProperty("CellValue",h,1,2)
oItems:SetProperty("CellValue",h,2,3)
h := oItems:AddItem(4)
oItems:SetProperty("CellValue",h,1,5)
oItems:SetProperty("CellValue",h,2,6)
h := oItems:AddItem(7)
oItems:SetProperty("CellValue",h,1,8)
oItems:SetProperty("CellValue",h,2,9)
oGrid:Layout := "multiplesort=" + CHR(34) + "C1:1 C2:2" + CHR(34) + ""
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
971
|
Is it possible to have a different alignment for parts of the cell's caption

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:TreeColumnIndex := -1
oGrid:DrawGridLines := -2/*exRowLines*/
oColumn := oGrid:Columns():Add("Default")
oColumn:SetProperty("Def",0/*exCellHasCheckBox*/,.T.)
oItems := oGrid:Items()
oItems:SetProperty("CellHAlignment",oItems:AddItem("all-left"),0,0/*LeftAlignment*/)
oItems:SetProperty("CellHAlignment",oItems:AddItem("all-center"),0,1/*CenterAlignment*/)
oItems:SetProperty("CellHAlignment",oItems:AddItem("all-right"),0,2/*RightAlignment*/)
h := oItems:AddItem("left<c>center<r>right")
oItems:SetProperty("CellValueFormat",h,0,1/*exHTML*/)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
970
|
I have a column with Def(exCellSingleLine) property on False, word-wrapping, and I am wondering if possible to update the column's content while user is resizing it
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL oColumns
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oColumns := oGrid:Columns()
oColumn := oColumns:Add("MultipleLine")
oColumn:Width := 32
oColumn:SetProperty("Def",16/*exCellSingleLine*/,.F.)
oColumn:SetProperty("Def",64/*exColumnResizeContiguously*/,.T.)
oColumn1 := oColumns:Add("SingleLine")
oColumn1:SetProperty("Def",16/*exCellSingleLine*/,.F.)
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem("This is a bit of long text that should break the line"),1,"This is a bit of long text that should break the line")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
969
|
How can I get the absolute position of an item
PROCEDURE OnMouseMove(oGrid,Button,Shift,X,Y)
LOCAL oItems
oItems := oGrid:Items()
DevOut( oItems:CellCaption(oGrid:ItemFromPoint(-1,-1,c,hit),"Position") )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:MouseMove := {|Button,Shift,X,Y| OnMouseMove(oGrid,Button,Shift,X,Y)} /*Occurs when the user moves the mouse.*/
oGrid:BeginUpdate()
oGrid:SetProperty("BackColorAlternate",AutomationTranslateColor( GraMakeRGBColor ( { 240,240,240 } ) , .F. ))
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:Columns():Add("Def"):DisplayFilterButton := .T.
oItems := oGrid:Items()
h := oItems:AddItem("Root")
oItems:InsertItem(oItems:InsertItem(h,,"Child 1"),,"Sub-Child 1")
oItems:InsertItem(oItems:InsertItem(h,,"Child 2"),,"Sub-Child 2")
oGrid:PutItems(oGrid:GetItems(-1))
oGrid:PutItems(oGrid:GetItems(-1))
oGrid:PutItems(oGrid:GetItems(-1))
oColumn := oGrid:Columns():Add("Position")
oColumn:FormatColumn := "1 apos ``"
oColumn:Visible := .F.
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
968
|
I am using ExComboBox as an user editor, how can I display a different column

PROCEDURE OnUserEditorClose(oGrid,Object,Item,ColIndex)
/*Items.CellValue(Item,ColIndex) = Object.Value*/
RETURN
PROCEDURE OnUserEditorOleEvent(oGrid,Object,Ev,CloseEditor,Item,ColIndex)
DevOut( Transform(Ev,"") )
RETURN
PROCEDURE OnUserEditorOpen(oGrid,Object,Item,ColIndex)
/*Object.Value = Me.Items.CellValue(Item,ColIndex)*/
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL oComboBox
LOCAL oEditor
LOCAL oItems
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:UserEditorClose := {|Object,Item,ColIndex| OnUserEditorClose(oGrid,Object,Item,ColIndex)} /*Fired the user editor is about to be opened.*/
oGrid:UserEditorOleEvent := {|Object,Ev,CloseEditor,Item,ColIndex| OnUserEditorOleEvent(oGrid,Object,Ev,CloseEditor,Item,ColIndex)} /*Occurs when an user editor fires an event.*/
oGrid:UserEditorOpen := {|Object,Item,ColIndex| OnUserEditorOpen(oGrid,Object,Item,ColIndex)} /*Occurs when an user editor is about to be opened.*/
oGrid:BeginUpdate()
oEditor := oGrid:Columns():Add("Exontrol.ComboBox"):Editor()
oEditor:EditType := 16/*UserEditorType*/
oEditor:UserEditor("Exontrol.ComboBox","")
oComboBox := oEditor:UserEditorObject()
oComboBox:BeginUpdate()
oComboBox:Style := 2/*DropDownList*/
oComboBox:ColumnAutoResize := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oComboBox:DataSource := rs
oComboBox:Alignment := 0/*LeftAlignment*/
oComboBox:IntegralHeight := .T.
oComboBox:MinHeightList := 128
oComboBox:MinWidthList := 648
oComboBox:HeaderHeight := 36
oComboBox:AllowSizeGrip := .T.
oComboBox:SingleEdit := .T.
oComboBox:LabelColumnIndex := 7
oComboBox:SearchColumnIndex := 0
oColumn := oComboBox:Columns:Item(0)
oColumn:HeaderBold := .T.
oColumn:HTMLCaption := "OrderID<br><fgcolor=808080>(search)"
oColumn1 := oComboBox:Columns:Item(7)
oColumn1:HeaderBold := .T.
oColumn1:HTMLCaption := "ShipName<br><fgcolor=808080>(display)"
oColumn1:Width := 128
oComboBox:UseTabKey := .F.
oComboBox:EndUpdate()
oGrid:DrawGridLines := -2/*exRowLines*/
oGrid:DefaultItemHeight := 21
oItems := oGrid:Items()
oItems:SetProperty("CellEditorVisible",oItems:AddItem(10248),0,1/*exEditorVisible*/)
oItems:SetProperty("CellEditorVisible",oItems:AddItem(10249),0,1/*exEditorVisible*/)
oItems:SetProperty("CellEditorVisible",oItems:AddItem(10250),0,1/*exEditorVisible*/)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
967
|
How do I sort the index column as numeric (Method 3)

PROCEDURE OnAddItem(oGrid,Item)
LOCAL oItems
oItems := oGrid:Items()
oItems:SetProperty("CellData",Item,1,oItems:CellCaption(Item,1))
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:AddItem := {|Item| OnAddItem(oGrid,Item)} /*Occurs after a new Item has been inserted to Items collection.*/
oGrid:BeginUpdate()
oGrid:DrawGridLines := -1/*exAllLines*/
oGrid:ColumnAutoResize := .T.
oGrid:ShowFocusRect := .F.
oColumn := oGrid:Columns():Add("Next")
oColumn:SetProperty("Def",48/*exCellPaddingLeft*/,4)
oColumn:SetProperty("Def",52/*exHeaderPaddingLeft*/,4)
oColumn1 := oGrid:Columns():Add("Index")
oColumn1:AllowSizing := .F.
oColumn1:Width := 48
oColumn1:FormatColumn := "(((0 := (1 index ``)) mod 3) case ( default: ``; 0 : `<r><fgcolor=B0B0B0>`; 1: ``; 2 : `<c><fgcolor=808080>` )) + str(=:0)"
oColumn1:SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn1:SortType := 5/*SortUserData*/
oColumn1:Position := 0
oItems := oGrid:Items()
oItems:AddItem("Item 1")
oItems:AddItem("Item 2")
oItems:AddItem("Item 3")
oItems:AddItem("Item 4")
oItems:AddItem("Item 5")
oItems:AddItem("Item 6")
oItems:AddItem("Item 7")
oItems:AddItem("Item 8")
oItems:AddItem("Item 9")
oItems:AddItem("Item 10")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
966
|
How do I sort the index column as numeric (Method 2)

PROCEDURE OnAddItem(oGrid,Item)
LOCAL oItems
oItems := oGrid:Items()
oItems:SetProperty("CellSortData",Item,1,oItems:CellCaption(Item,1))
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:AddItem := {|Item| OnAddItem(oGrid,Item)} /*Occurs after a new Item has been inserted to Items collection.*/
oGrid:BeginUpdate()
oGrid:DrawGridLines := -1/*exAllLines*/
oGrid:ColumnAutoResize := .T.
oGrid:ShowFocusRect := .F.
oColumn := oGrid:Columns():Add("Next")
oColumn:SetProperty("Def",48/*exCellPaddingLeft*/,4)
oColumn:SetProperty("Def",52/*exHeaderPaddingLeft*/,4)
oColumn1 := oGrid:Columns():Add("Index")
oColumn1:AllowSizing := .F.
oColumn1:Width := 48
oColumn1:FormatColumn := "(((0 := (1 index ``)) mod 3) case ( default: ``; 0 : `<r><fgcolor=B0B0B0>`; 1: ``; 2 : `<c><fgcolor=808080>` )) + str(=:0)"
oColumn1:SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn1:SortType := 6/*SortCellData*/
oColumn1:Position := 0
oItems := oGrid:Items()
oItems:AddItem("Item 1")
oItems:AddItem("Item 2")
oItems:AddItem("Item 3")
oItems:AddItem("Item 4")
oItems:AddItem("Item 5")
oItems:AddItem("Item 6")
oItems:AddItem("Item 7")
oItems:AddItem("Item 8")
oItems:AddItem("Item 9")
oItems:AddItem("Item 10")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
965
|
How do I sort the index column as numeric (Method 1)

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oColumn := oGrid:Columns():Add("Sort Index As String (Default)")
oColumn:FormatColumn := "1 index ``"
oColumn1 := oGrid:Columns():Add("Sort Index As Numeric")
oColumn1:ComputedField := "%C0"
oColumn1:SortType := 1/*SortNumeric*/
oItems := oGrid:Items()
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
964
|
How can I put icons/images into buttons

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:Images("gBJJgBAIDAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTqlVq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBwWDwmFw2HxGJxWLxmNx0xiFdyOTh8Tf9ZymXx+QytcyNgz8r0OblWjyWds+m0ka1Vf1ta1+r1mos2xrG2xeZ0+a0W0qOx3GO4NV3WeyvD2XJ5XL5nN51aiw+lfSj0gkUkAEllHanHI5j/cHg8EZf7w8vl8j4f/qfEZeB09/vjLAB30+kZQAP/P5/H6/yNAOAEAwCjMBwFAEDwJBMDwLBYAP2/8Hv8/gAGAD8LQs9w/nhDY/oygIA=")
oColumn := oGrid:Columns():Add("C+B")
oColumn:AllowSizing := .F.
oColumn:Width := 48
oColumn:FormatColumn := "` <img>` + ( 1 + (1 index ``) mod 3 ) + `</img> `"
oColumn:SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn:SetProperty("Def",0/*exCellHasCheckBox*/,.T.)
oColumn:SetProperty("Def",2/*exCellHasButton*/,.T.)
oColumn:SetProperty("Def",3/*exCellButtonAutoWidth*/,.T.)
oGrid:Columns():Add("")
oGrid:DrawGridLines := 2/*exVLines*/
oGrid:DefaultItemHeight := 20
oItems := oGrid:Items()
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
963
|
Is it possible to have a CheckBox and Button TOGETHER on all cells in a column

PROCEDURE OnButtonClick(oGrid,Item,ColIndex,Key)
DevOut( "ButtonClick" )
DevOut( Transform(Item,"") )
DevOut( Transform(Key,"") )
RETURN
PROCEDURE OnCellStateChanged(oGrid,Item,ColIndex)
DevOut( "CellStateChanged" )
DevOut( Transform(Item,"") )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:ButtonClick := {|Item,ColIndex,Key| OnButtonClick(oGrid,Item,ColIndex,Key)} /*Occurs when user clicks on the cell's button.*/
oGrid:CellStateChanged := {|Item,ColIndex| OnCellStateChanged(oGrid,Item,ColIndex)} /*Fired after cell's state has been changed.*/
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oColumn := oGrid:Columns():Add("")
oColumn:AllowSizing := .F.
oColumn:Width := 32
oColumn:FormatColumn := "1 index ``"
oColumn1 := oGrid:Columns():Add("Def")
oColumn1:AllowSizing := .F.
oColumn1:Width := 48
oColumn1:FormatColumn := "` `"
oColumn1:SetProperty("Def",0/*exCellHasCheckBox*/,.T.)
oColumn1:SetProperty("Def",2/*exCellHasButton*/,.T.)
oColumn1:SetProperty("Def",3/*exCellButtonAutoWidth*/,.T.)
oGrid:Columns():Add("")
oItems := oGrid:Items()
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
962
|
I have columns that look up the same data. (e.g. different contact) so both could / should use the same editor. Is this possible, to use other column's editor

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oColumns
LOCAL var_Editor
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:SetProperty("SelBackColor",oGrid:BackColor())
oGrid:SetProperty("SelForeColor",oGrid:ForeColor())
oColumns := oGrid:Columns()
oColumn := oColumns:Add("Pos")
oColumn:Width := 32
oColumn:AllowSizing := .F.
oColumn:FormatColumn := "1 index ``"
var_Editor := oColumns:Add("C1"):Editor()
var_Editor:EditType := 17/*ColorListType*/
var_Editor:ClearItems()
var_Editor:AddItem(255,"Red Color")
var_Editor:AddItem(16711680,"Blue Color")
var_Editor:AddItem(65280,"Green Color")
oColumns:Add("C2"):Editor():EditType := 268435457/*CloneType+EditType*/
oColumns:Add("C3"):Editor():EditType := 268435457/*CloneType+EditType*/
oItems := oGrid:Items()
h := oItems:AddItem("")
oItems:SetProperty("CellValue",h,1,16711680)
oItems:SetProperty("CellValue",h,2,65280)
oItems:SetProperty("CellValue",h,3,255)
h := oItems:AddItem("")
oItems:SetProperty("CellValue",h,1,255)
oItems:SetProperty("CellValue",h,2,16711680)
oItems:SetProperty("CellValue",h,3,65280)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
961
|
Is there an easy way to get an effect like in a Microsoft Access / SQL-Server Table view, where you can scroll-up till the last row containing data is displayed as top-row

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:HasLines := 0/*exNoLine*/
oGrid:ColumnAutoResize := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:ScrollBars := 2051/*exVScrollEmptySpace+exBoth*/
oGrid:SetProperty("ScrollPos",.T.,oGrid:Items:ItemCount())
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
960
|
Does filtering work with umlauts / accents characters
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oColumn := oGrid:Columns():Add("Names")
oColumn:DisplayFilterButton := .T.
oColumn:FilterType := 3/*exPattern*/
oItems := oGrid:Items()
oItems:AddItem("Mantel")
oItems:AddItem("Mechanik")
oItems:AddItem("Motor")
oItems:AddItem("Murks")
oItems:AddItem("Märchen")
oItems:AddItem("Möhren")
oItems:AddItem("Mühle")
oItems:AddItem("Sérigraphie")
oGrid:Columns:Item(0):Filter := "*ä*"
oGrid:ApplyFilter()
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
959
|
How FullPath method works

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:Columns():Add("C1")
oGrid:Columns():Add("C2")
oItems := oGrid:Items()
h := oItems:AddItem("Root")
oItems:SetProperty("CellValue",h,1,"A")
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 1"),1,"B")
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 2"),1,"C")
oItems:SetProperty("ExpandItem",h,.T.)
oGrid:SearchColumnIndex := 1
DevOut( Transform(oGrid:SearchColumnIndex(),"") )
DevOut( :FullPath(oGrid:Items:ItemByIndex(2)) )
oGrid:SearchColumnIndex := 0
DevOut( Transform(oGrid:SearchColumnIndex(),"") )
DevOut( :FullPath(oGrid:Items:ItemByIndex(2)) )
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
958
|
Can I set the search box / filterbarprompt to invisible, so I can use my own input and *string* via VBA
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h0
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:FilterBarHeight := 0
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oItems := oGrid:Items()
h0 := oItems:AddItem("Nancy Davolio")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Andrew Fuller")
oItems:SetProperty("CellValue",h0,1,"Vice President, Sales")
oItems:SetProperty("CellValue",h0,2,"Tacoma")
oItems:SetProperty("SelectItem",h0,.T.)
h0 := oItems:AddItem("Janet Leverling")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Kirkland")
h0 := oItems:AddItem("Margaret Peacock")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Redmond")
h0 := oItems:AddItem("Steven Buchanan")
oItems:SetProperty("CellValue",h0,1,"Sales Manager")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Michael Suyama")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Robert King")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Laura Callahan")
oItems:SetProperty("CellValue",h0,1,"Inside Sales Coordinator")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Anne Dodsworth")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
oGrid:FilterBarPromptPattern := "London"
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
957
|
How to load a hierarchy using the control's DataSource property (Parent-ID-Relation)

PROCEDURE OnAddItem(oGrid,Item)
LOCAL oItems
oItems := oGrid:Items()
oItems:SetParent(Item,oItems:FindItem(oItems:CellValue(Item,"ReportsTo"),"EmployeeID"))
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:AddItem := {|Item| OnAddItem(oGrid,Item)} /*Occurs after a new Item has been inserted to Items collection.*/
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:ColumnAutoResize := .F.
oGrid:ContinueColumnScroll := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("SELECT * FROM Employees ORDER BY ReportsTo","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:Items():SetProperty("ExpandItem",0,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
956
|
Is it possible to select the entire row/line, when user clicks the first column, and select individually the rest of cells, while user clicks any other column

PROCEDURE OnMouseDown(oGrid,Button,Shift,X,Y)
LOCAL i
i := oGrid:ItemFromPoint(-1,-1,c,hit)
oGrid:FullRowSelect := oGrid:Columns:Item(c):Data()
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:MouseDown := {|Button,Shift,X,Y| OnMouseDown(oGrid,Button,Shift,X,Y)} /*Occurs when the user presses a mouse button.*/
oGrid:BeginUpdate()
oGrid:HeaderHeight := 22
oGrid:HeaderAppearance := 1/*Flat*/
oGrid:SetProperty("BackColorLock",AutomationTranslateColor( GraMakeRGBColor ( { 240,240,240 } ) , .F. ))
oGrid:SetProperty("BackColorHeader",oGrid:BackColorLock())
oGrid:HasLines := 0/*exNoLine*/
oGrid:ColumnAutoResize := .F.
oGrid:SortBarVisible := .F.
oGrid:AllowGroupBy := .T.
oGrid:ReadOnly := -1/*exReadOnly*/
oGrid:ShowFocusRect := .F.
oGrid:CountLockedColumns := 1
oGrid:AutoDrag := 16/*exAutoDragScroll*/
oGrid:SingleSort := .F.
oGrid:ColumnsAllowSizing := .T.
oGrid:DrawGridLines := -1/*exAllLines*/
oGrid:GridLineStyle := 48/*exGridLinesSolid*/
oGrid:SetProperty("GridLineColor",AutomationTranslateColor( GraMakeRGBColor ( { 220,220,220 } ) , .F. ))
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:Columns:Item(0):Data := -1
oGrid:Layout := "singlesort=" + CHR(34) + "C5:1" + CHR(34) + ";multiplesort=" + CHR(34) + " C1:2" + CHR(34) + ""
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
955
|
The user are not able to size the columns at runtime when using HeaderAppearance property on zero
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:VisualAppearance():Add(1,"gBFLBCJwBAEHhEJAAEhABJEIQAAYAQGKIYBkAKBQAGaAoDDcMQ5QwAAyDGKEEwsACEIrjKCRShyCYZRhGcTSBCIZBqEqSZLiEZRQiiCYsS5GQBSFDcOwHGyQZonKK3LhGCYBgIA=")
oGrid:HeaderAppearance := 16777216/*0x1000000+*/
oGrid:Columns():Add(Transform(1,""))
oGrid:Columns():Add(Transform(2,""))
oGrid:Columns():Add(Transform(3,""))
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
954
|
Is it possible to embed the exGauge into the exGrid control

PROCEDURE OnItemOleEvent(oGrid,Item,Ev)
LOCAL oGauge
LOCAL v
oGauge := oGrid:Items():ItemObject(oGrid:Items():ItemByIndex(2))
v := oGauge:FormatABC("date(`now`)")
oGauge:Layers:Item("sec"):Value := v
oGauge:Layers:Item("min"):Value := v
oGauge:Layers:Item("hour"):Value := v
RETURN
PROCEDURE OnMouseMove(oGrid,Button,Shift,X,Y)
LOCAL oGauge
oGauge := oGrid:Items():ItemObject(oGrid:Items():ItemByIndex(2))
oGauge:TimerInterval := 1000
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oGauge
LOCAL oItems
LOCAL oLayer,oLayer1,oLayer2,oLayer3
LOCAL h,v
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:ItemOleEvent := {|Item,Ev| OnItemOleEvent(oGrid,Item,Ev)} /*Fired when an ActiveX control hosted by an item has fired an event.*/
oGrid:MouseMove := {|Button,Shift,X,Y| OnMouseMove(oGrid,Button,Shift,X,Y)} /*Occurs when the user moves the mouse.*/
oGrid:BeginUpdate()
oGrid:ScrollBySingleLine := .T.
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:HasLines := 2/*exThinLine*/
oGrid:ScrollBySingleLine := .T.
oGrid:Columns():Add("Default")
oItems := oGrid:Items()
h := oItems:AddItem("Normal Item")
h := oItems:AddItem("Gauge-Clock Inside")
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:InsertControlItem(h,"Exontrol.Gauge")
oItems:SetProperty("ItemHeight",h,256)
oGauge := oItems:ItemObject(h)
oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Clock"
oGauge:SetProperty("DefaultLayer",185/*exDefLayerRotateType*/,2)
oGauge:Layers():Count := 4
oLayer := oGauge:Layers:Item(0)
oLayer:Background():Picture():Name := "vista_clock.png"
oLayer1 := oGauge:Layers:Item(1)
oLayer1:Position := 3
oLayer1:Key := "sec"
oLayer1:OnDrag := 2/*exDoRotate*/
oLayer1:Selectable := .F.
oLayer1:Background():Picture():Name := "second-hand.png"
oLayer1:ValueToRotateAngle := "((2:=(((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - floor(=:1)) * 60 )) - floor(=:2) ) * 360"
oLayer1:RotateAngleToValue := "value / 360 / 24 / 60"
oLayer2 := oGauge:Layers:Item(2)
oLayer2:Position := 2
oLayer2:Key := "min"
oLayer2:OnDrag := 2/*exDoRotate*/
oLayer2:Selectable := .F.
oLayer2:Background():Picture():Name := "Minute.png"
oLayer2:ValueToRotateAngle := "((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - floor(=:1)) * 360"
oLayer2:RotateAngleToValue := "value / 360 / 24 / 60"
oLayer3 := oGauge:Layers:Item(3)
oLayer3:Position := 1
oLayer3:Key := "hour"
oLayer3:OnDrag := 2/*exDoRotate*/
oLayer3:Background():Picture():Name := "Hour.png"
oLayer3:ValueToRotateAngle := "2 * 360 * ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) )"
oLayer3:RotateAngleToValue := "value / 360 * 0.5"
v := oGauge:FormatABC("date(`now`)")
oGauge:Layers:Item("sec"):Value := v
oGauge:Layers:Item("min"):Value := v
oGauge:Layers:Item("hour"):Value := v
h := oItems:AddItem("Normal Item")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
953
|
What's the difference between merge cells and divider item

PROCEDURE OnAddItem(oGrid,Item)
LOCAL oItems
oItems := oGrid:Items()
oItems:SetProperty("CellBackColor",Item,0,AutomationTranslateColor( GraMakeRGBColor ( { 240,240,240 } ) , .F. ))
oItems:SetProperty("ItemHasChildren",Item,.T.)
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:AddItem := {|Item| OnAddItem(oGrid,Item)} /*Occurs after a new Item has been inserted to Items collection.*/
oGrid:BeginUpdate()
oGrid:TreeColumnIndex := 0
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:DrawGridLines := -1/*exAllLines*/
oGrid:Columns():Add("C1"):FormatColumn := "1 index `A-Z`"
oGrid:Columns():Add("C2"):FormatColumn := "1 index ``"
oGrid:Columns():Add("C3"):FormatColumn := "1 index ``"
oItems := oGrid:Items()
oItems:AddItem()
oItems:AddItem()
h := oItems:AddItem()
oItems:SetProperty("CellMerge",h,0,1)
oItems:SetProperty("FormatCell",h,0,"`merge cells`")
oItems:SetProperty("CellHAlignment",h,0,1/*CenterAlignment*/)
h := oItems:AddItem()
oItems:SetProperty("ItemDivider",h,0)
oItems:SetProperty("CellHAlignment",h,0,1/*CenterAlignment*/)
oItems:SetProperty("FormatCell",h,0,"`item divider`")
oItems:AddItem()
oItems:AddItem()
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
952
|
is it possible to resize a column with the mouse without changing the width of the next column

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .F.
oGrid:Columns():Add("Column 1"):Width := 256
oGrid:Columns():Add("Column 2"):Width := 512
oGrid:DrawGridLines := -1/*exAllLines*/
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
951
|
How do I ensure that the newly item fits the control's client area

PROCEDURE OnButtonClick(oGrid,Item,ColIndex,Key)
LOCAL oItems
LOCAL h
oItems := oGrid:Items()
h := oItems:AddItem("")
oItems:SetProperty("SelectItem",h,.T.)
oItems:EnsureVisibleItem(h)
oGrid:FocusColumnIndex := 0
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:ButtonClick := {|Item,ColIndex,Key| OnButtonClick(oGrid,Item,ColIndex,Key)} /*Occurs when user clicks on the cell's button.*/
oGrid:BeginUpdate()
oColumn := oGrid:Columns():Add("")
oColumn:AllowSizing := .F.
oColumn:AllowDragging := .F.
oColumn:AllowSort := .F.
oColumn:Width := 24
oColumn:SetProperty("Def",2/*exCellHasButton*/,.T.)
oGrid:Columns():Add("Position"):FormatColumn := "1 apos `A-Z`"
oGrid:CountLockedColumns := 1
oItems := oGrid:Items()
oItems:AddItem("")
oItems:AddItem("")
oItems:AddItem("")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
950
|
How do I find the predefined string for giving value, or giving identifier for specified predefined caption of editor

PROCEDURE OnChange(oGrid,Item,ColIndex,NewValue)
DevOut( "FindItem(numeric) is " )
DevOut( Transform(NewValue,"") )
DevOut( Transform(oGrid:Columns:Item(0):Editor():FindItem(NewValue),"") )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1,oColumn2
LOCAL oEditor
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:Change := {|Item,ColIndex,NewValue| OnChange(oGrid,Item,ColIndex,NewValue)} /*Occurs when the user changes the cell's content.*/
oGrid:BeginUpdate()
oColumn := oGrid:Columns():Add("DropDownList")
oEditor := oColumn:Editor()
oEditor:EditType := 3/*DropDownListType*/
oEditor:AddItem(1,"Ken Robinson")
oEditor:AddItem(2,"Dave Nichols")
oEditor:AddItem(3,"Zane Thomas")
oEditor:AddItem(4,"James Shields")
oColumn1 := oGrid:Columns():Add("CellValue")
oColumn1:FormatColumn := "%0"
oColumn1:SetProperty("Def",4/*exCellBackColor*/,15790320)
oColumn1:SetProperty("Def",7/*exHeaderBackColor*/,oColumn1:Def(4/*exCellBackColor*/))
oColumn2 := oGrid:Columns():Add("CellCaption")
oColumn2:FormatColumn := "%C0"
oColumn2:SetProperty("Def",4/*exCellBackColor*/,15790320)
oColumn2:SetProperty("Def",7/*exHeaderBackColor*/,oColumn2:Def(4/*exCellBackColor*/))
oItems := oGrid:Items()
oItems:AddItem(1)
oItems:AddItem(oGrid:Columns():Item(0):Editor():FindItem("Zane Thomas"))
oItems:AddItem(2)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
949
|
How can I align captions of items with checkbox, with items with no checkbox

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("Default")
oItems := oGrid:Items()
oItems:SetProperty("CellImages",oItems:AddItem(0),0,"1")
oItems:SetProperty("CellHasCheckBox",oItems:AddItem(1),0,.T.)
oItems:SetProperty("CellImages",oItems:AddItem(2),0,"1")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
948
|
How can I prevent sorting a column

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oColumn := oGrid:Columns():Add("Default")
oColumn:SetProperty("Def",0/*exCellHasCheckBox*/,.T.)
oColumn:PartialCheck := .T.
oColumn:AllowSort := .F.
oItems := oGrid:Items()
h := oItems:AddItem("Root")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("ExpandItem",h,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
947
|
Is there a possibility to group without moving and showing the column to the SortBar

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:HasLines := 0/*exNoLine*/
oGrid:ColumnAutoResize := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:SingleSort := .F.
oGrid:SortBarVisible := .F.
oGrid:AllowGroupBy := .T.
oGrid:Layout := "singlesort=" + CHR(34) + "C5:1" + CHR(34) + ";multiplesort=" + CHR(34) + " C1:2" + CHR(34) + ""
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
946
|
How can I show each group header ( not-subroup ), with a different background color, while alternate background colors for inside items

PROCEDURE OnLayoutChanged(oGrid)
oGrid:Refresh()
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:LayoutChanged := {|| OnLayoutChanged(oGrid)} /*Occurs when column's position or column's size is changed.*/
oGrid:BeginUpdate()
oGrid:HasLines := 0/*exNoLine*/
oGrid:ColumnAutoResize := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:SingleSort := .F.
oGrid:SortBarVisible := .T.
oGrid:AllowGroupBy := .T.
oGrid:Columns:Item(1):SortOrder := -1/*0xfffffffc+SortDescending+SortAscending*/
oColumn := oGrid:Columns():Add("Position")
oColumn:FormatColumn := "(0:= (1 rpos '')) right ( ( 1:= ( =:0 rfind `.` ) ) != -1 ? =:1 : len(=:0))"
oColumn:Visible := .F.
oColumn1 := oGrid:Columns():Add("Position")
oColumn1:FormatColumn := "(1 rpos '') contains '.'"
oColumn1:Visible := .F.
oGrid:ConditionalFormats():Add("(%C13 mod 2) != 0"):SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 240,240,240 } ) , .F. ))
oGrid:ConditionalFormats():Add("%C14 = 0"):SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 190,190,190 } ) , .F. ))
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
945
|
What is the difference between %0 and %C0, when using in expressions ( format, conditional format, computed fields, and so on )

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL oEditor
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:HeaderAppearance := 4/*Etched*/
oGrid:HeaderHeight := 24
oGrid:ScrollBySingleLine := .T.
oGrid:DrawGridLines := -2/*exRowLines*/
oGrid:Columns():Add("Value"):SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn := oGrid:Columns():Add("FormatColumn = `%0` ~ CellValue")
oColumn:FormatColumn := "%0"
oColumn:SetProperty("Def",16/*exCellSingleLine*/,.F.)
oColumn1 := oGrid:Columns():Add("FormatColumn = `%C0`~ CellCaption")
oColumn1:FormatColumn := "%C0"
oColumn1:SetProperty("Def",16/*exCellSingleLine*/,.F.)
oItems := oGrid:Items()
oItems:AddItem(1.1234)
oItems:SetProperty("CellValueFormat",oItems:AddItem("<sha ;;0>This <fgcolor=FF0000>is a <s><b>HTM</fgcolor>L</b> text</s>."),0,1/*exHTML*/)
oEditor := oItems:CellEditor(oItems:AddItem(3))
oEditor:EditType := 6/*CheckListType*/
oEditor:AddItem(1,"Border")
oEditor:AddItem(2,"Thick")
oEditor:AddItem(4,"Shadow")
oItems:SetProperty("FormatCell",oItems:AddItem(10000),0,"`<b>` + currency(value)")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
944
|
How can I alternate colors for each group header ( not-subroup ), with a different background color, while items of the same group showing with a different color

PROCEDURE OnLayoutChanged(oGrid)
oGrid:Refresh()
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:LayoutChanged := {|| OnLayoutChanged(oGrid)} /*Occurs when column's position or column's size is changed.*/
oGrid:BeginUpdate()
oGrid:HasLines := 0/*exNoLine*/
oGrid:ColumnAutoResize := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:SingleSort := .F.
oGrid:SortBarVisible := .T.
oGrid:AllowGroupBy := .T.
oGrid:Columns:Item(1):SortOrder := -1/*0xfffffffc+SortDescending+SortAscending*/
oColumn := oGrid:Columns():Add("Position")
oColumn:FormatColumn := "(0:= (1 rpos '')) left ( ( 1:= ( =:0 lfind `.` ) ) != -1 ? =:1 : len(=:0))"
oColumn:Visible := .F.
oColumn1 := oGrid:Columns():Add("Position")
oColumn1:FormatColumn := "(1 rpos '') contains '.'"
oColumn1:Visible := .F.
oGrid:ConditionalFormats():Add("(%C13 mod 2) != 0"):SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 240,240,240 } ) , .F. ))
oGrid:ConditionalFormats():Add("%C14 = 0"):SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 190,190,190 } ) , .F. ))
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
943
|
How can I highlight each group header, with a different background color (method 2)

PROCEDURE OnAddGroupItem(oGrid,Item)
oGrid:Items():SetProperty("ItemBackColor",Item,AutomationTranslateColor( GraMakeRGBColor ( { 190,190,190 } ) , .F. ))
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:AddGroupItem := {|Item| OnAddGroupItem(oGrid,Item)} /*Occurs after a new Group Item has been inserted to Items collection.*/
oGrid:BeginUpdate()
oGrid:HasLines := 0/*exNoLine*/
oGrid:ColumnAutoResize := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:SingleSort := .F.
oGrid:SortBarVisible := .T.
oGrid:AllowGroupBy := .T.
oGrid:Columns:Item(1):SortOrder := -1/*0xfffffffc+SortDescending+SortAscending*/
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
942
|
How can I highlight each group header ( not-subroup ), with a different background color (method 1)

PROCEDURE OnLayoutChanged(oGrid)
oGrid:Refresh()
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:LayoutChanged := {|| OnLayoutChanged(oGrid)} /*Occurs when column's position or column's size is changed.*/
oGrid:BeginUpdate()
oGrid:HasLines := 0/*exNoLine*/
oGrid:ColumnAutoResize := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:SingleSort := .F.
oGrid:SortBarVisible := .T.
oGrid:AllowGroupBy := .T.
oGrid:Columns:Item(1):SortOrder := -1/*0xfffffffc+SortDescending+SortAscending*/
oColumn := oGrid:Columns():Add("Position")
oColumn:FormatColumn := "(0:= (1 rpos '')) left ( ( 1:= ( =:0 lfind `.` ) ) != -1 ? =:1 : len(=:0))"
oColumn:Visible := .F.
oColumn1 := oGrid:Columns():Add("Position")
oColumn1:FormatColumn := "(1 rpos '') contains '.'"
oColumn1:Visible := .F.
oGrid:ConditionalFormats():Add("%C14 = 0"):SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 190,190,190 } ) , .F. ))
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
941
|
The BackColorAlternate displays each second row with a different background color. Is it possible to apply a different background color, for each sub-tree, ConditionalFormats, Add

PROCEDURE OnLayoutChanged(oGrid)
oGrid:Refresh()
RETURN
PROCEDURE OnSort(oGrid)
oGrid:Refresh()
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1,oColumn2
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:LayoutChanged := {|| OnLayoutChanged(oGrid)} /*Occurs when column's position or column's size is changed.*/
oGrid:Sort := {|| OnSort(oGrid)} /*Fired when the control sorts a column.*/
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oColumn := oGrid:Columns():Add("P1")
oColumn:SetProperty("Def",0/*exCellHasCheckBox*/,.T.)
oColumn:PartialCheck := .T.
oColumn1 := oGrid:Columns():Add("P2")
oColumn1:SetProperty("Def",0/*exCellHasCheckBox*/,.T.)
oColumn1:PartialCheck := .T.
oItems := oGrid:Items()
h := oItems:AddItem("Root 1")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:AddItem("Root 2")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:AddItem("Root 2")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("ExpandItem",h,.T.)
oColumn2 := oGrid:Columns():Add("Position")
oColumn2:FormatColumn := "(0:= (1 rpos '')) left ( ( 1:= ( =:0 lfind `.` ) ) != -1 ? =:1 : len(=:0))"
oColumn2:Visible := .F.
oGrid:ConditionalFormats():Add("(%C2 mod 2) != 0"):SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 240,240,240 } ) , .F. ))
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
940
|
The BackColorAlternate displays each second row with a different background color. Is it possible to apply a different background color, for 2nd, 3rd, 4th, row, and so on

PROCEDURE OnLayoutChanged(oGrid)
oGrid:Refresh()
RETURN
PROCEDURE OnSort(oGrid)
oGrid:Refresh()
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:LayoutChanged := {|| OnLayoutChanged(oGrid)} /*Occurs when column's position or column's size is changed.*/
oGrid:Sort := {|| OnSort(oGrid)} /*Fired when the control sorts a column.*/
oGrid:BeginUpdate()
oGrid:HasLines := 0/*exNoLine*/
oGrid:ColumnAutoResize := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oColumn := oGrid:Columns():Add("Position")
oColumn:FormatColumn := "1 apos ''"
oColumn:Visible := .F.
oGrid:ConditionalFormats():Add("(%C13 mod 5) = 1"):SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 128,128,128 } ) , .F. ))
oGrid:ConditionalFormats():Add("(%C13 mod 5) = 2"):SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 164,164,164 } ) , .F. ))
oGrid:ConditionalFormats():Add("(%C13 mod 5) = 3"):SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 190,190,190 } ) , .F. ))
oGrid:ConditionalFormats():Add("(%C13 mod 5) = 4"):SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 240,240,240 } ) , .F. ))
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
939
|
The BackColorAlternate displays each second row with a different background color. The question I have it is possible to apply a different background color for 3rd, 4th, row, and so on

PROCEDURE OnLayoutChanged(oGrid)
oGrid:Refresh()
RETURN
PROCEDURE OnSort(oGrid)
oGrid:Refresh()
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:LayoutChanged := {|| OnLayoutChanged(oGrid)} /*Occurs when column's position or column's size is changed.*/
oGrid:Sort := {|| OnSort(oGrid)} /*Fired when the control sorts a column.*/
oGrid:BeginUpdate()
oGrid:HasLines := 0/*exNoLine*/
oGrid:ColumnAutoResize := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oColumn := oGrid:Columns():Add("Position")
oColumn:FormatColumn := "1 apos ''"
oColumn:Visible := .F.
oGrid:ConditionalFormats():Add("(%C13 mod 4) = 0"):SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 240,240,240 } ) , .F. ))
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
938
|
The BackColorAlternate looks fine for flat tables, but how about using it when displaying a hierarchy/tree, like grouping rows. The sample alternate colors for each group found

PROCEDURE OnLayoutChanged(oGrid)
oGrid:Refresh()
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:LayoutChanged := {|| OnLayoutChanged(oGrid)} /*Occurs when column's position or column's size is changed.*/
oGrid:BeginUpdate()
oGrid:HasLines := 0/*exNoLine*/
oGrid:ColumnAutoResize := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:SingleSort := .F.
oGrid:SortBarVisible := .T.
oGrid:AllowGroupBy := .T.
oGrid:Columns:Item(1):SortOrder := -1/*0xfffffffc+SortDescending+SortAscending*/
oColumn := oGrid:Columns():Add("Position")
oColumn:FormatColumn := "(0:= (1 rpos '')) left ( ( 1:= ( =:0 lfind `.` ) ) != -1 ? =:1 : len(=:0))"
oColumn:Visible := .F.
oGrid:ConditionalFormats():Add("(%C13 mod 2) != 0"):SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 240,240,240 } ) , .F. ))
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
937
|
I need to display sub-totals in the grouping items. Is there any solution on this

PROCEDURE OnAddGroupItem(oGrid,Item)
LOCAL oItems
oItems := oGrid:Items()
oItems:SetProperty("ItemDivider",Item,-1)
oItems:SetProperty("EnableItem",Item,.F.)
oItems:SetProperty("CellValueFormat",Item,oGrid:TreeColumnIndex(),1/*exHTML*/)
oItems:SetProperty("FormatCell",Item,oGrid:TreeColumnIndex(),"%1")
oItems:SetProperty("CellValueFormat",Item,"Freight",5/*exTotalField+exHTML*/)
oItems:SetProperty("CellValue",Item,"Freight","sum(current,dir,%6)")
oItems:SetProperty("FormatCell",Item,"Freight","`<b>` + currency(value)")
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:AddGroupItem := {|Item| OnAddGroupItem(oGrid,Item)} /*Occurs after a new Group Item has been inserted to Items collection.*/
oGrid:BeginUpdate()
oGrid:SelBackMode := 1/*exTransparent*/
oGrid:SetProperty("BackColorSortBar",AutomationTranslateColor( GraMakeRGBColor ( { 240,240,240 } ) , .F. ))
oGrid:ColumnAutoResize := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:SortBarVisible := .T.
oGrid:SortBarCaption := "Drag a <b>column</b> header here to group by that column."
oGrid:AllowGroupBy := .T.
oGrid:Columns:Item(1):SortOrder := 1/*SortAscending*/
oGrid:LinesAtRoot := 5/*exGroupLinesOutside*/
oGrid:Columns:Item("ShipVia"):DisplayFilterButton := .T.
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
936
|
I use a subtotal in exTop-Item, after grouping the item shows 0. What is the solution

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:SingleSort := .F.
oGrid:AllowGroupBy := .T.
oGrid:SortBarVisible := .T.
oGrid:SetProperty("BackColorSortBar",oGrid:BackColor())
oGrid:Columns:Item(5):SortOrder := 1/*SortAscending*/
oGrid:Columns:Item(6):FormatColumn := "currency(value)"
oItems := oGrid:Items()
oItems:SetProperty("LockedItemCount",0/*exTop*/,1)
h := oItems:LockedItem(0/*exTop*/,0)
oItems:SetProperty("ItemBackColor",h,AutomationTranslateColor( GraMakeRGBColor ( { 240,240,240 } ) , .F. ))
oItems:SetProperty("CellBackColor",h,6,AutomationTranslateColor( GraMakeRGBColor ( { 190,190,190 } ) , .F. ))
oItems:SetProperty("CellValue",h,6,"sum(all,rec,%6)")
oItems:SetProperty("CellValueFormat",h,6,4/*exTotalField*/)
oGrid:Refresh()
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
935
|
I would like to avoid manual typing in the date-cell because user often type wrong things (no decimal points and so on) and so the todays-date is generated for the cell. What can be done

PROCEDURE OnKeyPress(oGrid,KeyAscii)
DevOut( "if .Editying != 0 then" )
DevOut( Transform(oGrid:Editing(),"") )
KeyAscii := 0
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oColumns
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:KeyPress := {|KeyAscii| OnKeyPress(oGrid,KeyAscii)} /*Occurs when the user presses and releases an ANSI key.*/
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .F.
oColumns := oGrid:Columns()
oColumns:Add("Tasks")
oColumn := oColumns:Add("Date")
oColumn:Editor():EditType := 7/*DateType*/
oColumn:Width := 128
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem("Item 1"),1,"09/21/2006")
oItems:SetProperty("CellValue",oItems:AddItem("Item 2"),1,"12/22/2015")
oItems:SetProperty("CellValue",oItems:AddItem("Item 3"),1,"01/10/2015")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
934
|
The control does not ensure the item to fit the control's client area once the user clicks the cell's button or check box. What can be done
PROCEDURE OnMouseDown(oGrid,Button,Shift,X,Y)
/*Items.EnsureVisibleItem(ItemFromPoint(-1,-1,c,hit))*/
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:MouseDown := {|Button,Shift,X,Y| OnMouseDown(oGrid,Button,Shift,X,Y)} /*Occurs when the user presses a mouse button.*/
oGrid:BeginUpdate()
oGrid:TreeColumnIndex := -1
oGrid:SetProperty("SelForeColor",oGrid:ForeColor())
oColumn := oGrid:Columns():Add("Buttons")
oColumn:Alignment := 1/*CenterAlignment*/
oColumn:SetProperty("Def",2/*exCellHasButton*/,.T.)
oItems := oGrid:Items()
oItems:AddItem("Button A")
oItems:AddItem("Button B")
oItems:AddItem("Button C")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
933
|
How do you save the index number from a drop down to a database

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oEditor
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oColumn := oGrid:Columns:Item("ShipVia")
oColumn:SetProperty("Def",4/*exCellBackColor*/,15790320)
oColumn:Position := 1
oColumn:Width := 96
oEditor := oColumn:Editor()
oEditor:EditType := 3/*DropDownListType*/
oEditor:AddItem(1,"Speedy Express")
oEditor:AddItem(2,"United Package")
oEditor:AddItem(3,"Federal Shipping")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
932
|
Is there a way to set the column width and have it stay when refreshing using the data source

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:Layout := "gBjAAwAAuABmABpABsAB0ABlAByhoAPIAOEPAA9gYABoABQAgUEg0XN4AOcJicKkpujIAGMcj0gjcGk8QhkQgUOjUEjsfkMFAB2lEnhRihcYjUvnsykQAO8oMkTNEtGgAGUwn0uoEIhUMh0QiUOisXiE7rEyl8jAElokptYAllmpcCtMmjE3mU6jdzrUGoUKttGvFJs90oFPhVRh1Twg4wtaptco9fiMTsdIvcxw1Nkl2hUOlVwlsvnmayFAmtHnETuWm0lAv+eAGCzFK10zp1QqVUAGOvkvuuSr0YsMUi2Y0tZ4FAztt0FvuNa23Kvt2m0YnMt5No6uxwOq0eP5cGxAAxQAxgAGwAqu/q1blHDsGW49lzPUq9qtko58r8Krvc/LrPA7LWvw2ChpQ2j7Om7kBPK870hu+6ZQE4SJvmsT6u0x8BOa/iUP8jUANNATUrxAsKIFATvQU8DCL5B7dMWlr1u2gQZvgrsMMrDSyQ4vkcv02T+tEjUcyC1C7uw" +;
"1kVABISgwSosXq1JLyRm9EaycqqDQuyjisu+0bvY5i3udEMjTIvkuQHFEmzHNkWymwcqtNNkIN2jUbMeGsdMm4j6R/AyZT7IcztC6M+r5Qs2yYvUx0ZOTZypBqBUZPEaMax71y6+MeTBDdBoFTjjv2z80Oi9a+VJE9HSA01SUlBbw1Ww8sPSqtFNNCdOx3L9AuQx9eVLIlUJbCa+WHVrV0fYUEMBF06UqAFh0xLLCT7abHV7P8MuNQUnW3YlDuglrfNNcVlrzV6s3FWVKMfcVrPSq6rva0wcz8+Ue2/YK+XzQ0QUQlt83/JTr2ZdiZYBKNoTm2rH4ZedzSckqGDqAA2tEk7CSQmKEJKgWMY5CmQJlkaZYsAGMY0liFJYqKIDxhSpjCu0vUBQappOgSJZUhlBtTmyJIEqaBZVljRZe8yMZnoMl4SjQRI3qal3U7OjqPpOXNFmIAadCiHIkiDV6RjOla7puFKFnjK5/ta7Z6t6GIYkqEIQ1NmqWgIA="
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
931
|
Is it possible to decode/view the control's Layout property

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oPrint
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:SingleSort := .F.
oGrid:Columns():Add("C0")
oGrid:Columns():Add("C1"):SortOrder := 1/*SortAscending*/
oGrid:Columns():Add("C2")
oPrint := CreateObject("Exontrol.Print")
DevOut( oPrint:Decode64TextW(oGrid:Layout()) )
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
930
|
How do I programmatically sort by multiple columns

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:SingleSort := .F.
oGrid:Columns():Add("C0")
oGrid:Columns():Add("C1")
oGrid:Columns():Add("C2")
oGrid:Layout := "multiplesort=" + CHR(34) + "C2:1 C1:2 C0:2" + CHR(34) + ""
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
929
|
Do you have any Fit-To-Page options when printing the control (W x T, Fit-To )

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oPrint
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .F.
oGrid:ContinueColumnScroll := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:EndUpdate()
oPrint := CreateObject("Exontrol.Print")
oPrint:Options := "FitToPage =2 x 1"
oPrint:PrintExt := oGrid
oPrint:Preview()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
928
|
Do you have any Fit-To-Page options when printing the control ( x T, Fit-To Tall )

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oPrint
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .F.
oGrid:ContinueColumnScroll := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:EndUpdate()
oPrint := CreateObject("Exontrol.Print")
oPrint:Options := "FitToPage = x 2"
oPrint:PrintExt := oGrid
oPrint:Preview()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
927
|
Do you have any Fit-To-Page options when printing the control ( W x, Fit-To Wide )

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oPrint
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .F.
oGrid:ContinueColumnScroll := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:EndUpdate()
oPrint := CreateObject("Exontrol.Print")
oPrint:Options := "FitToPage = 2 x"
oPrint:PrintExt := oGrid
oPrint:Preview()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
926
|
Do you have any Fit-To-Page options when printing the control ( percent view, Adjust-To )

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oPrint
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .F.
oGrid:ContinueColumnScroll := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:EndUpdate()
oPrint := CreateObject("Exontrol.Print")
oPrint:Options := "FitToPage = 50%"
oPrint:PrintExt := oGrid
oPrint:Preview()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
925
|
How can I get notified once the user expands a column

PROCEDURE OnLayoutChanged(oGrid)
DevOut( "Column-Expanded" )
DevOut( Transform(oGrid:Columns:Item("C0"):Expanded(),"") )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oColumns
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:LayoutChanged := {|| OnLayoutChanged(oGrid)} /*Occurs when column's position or column's size is changed.*/
oGrid:BeginUpdate()
oGrid:ShowFocusRect := .F.
oGrid:ColumnAutoResize := .F.
oGrid:DrawGridLines := -1/*exAllLines*/
oGrid:SetProperty("BackColorLevelHeader",oGrid:BackColor())
oColumns := oGrid:Columns()
oColumn := oColumns:Add("C0")
oColumn:ExpandColumns := "0,1,2"
oColumn:DisplayExpandButton := .T.
oColumns:Add("C1")
oColumns:Add("C2")
oItems := oGrid:Items()
h := oItems:AddItem("Cell 0.0")
oItems:SetProperty("CellValue",h,1,"Cell 0.1")
oItems:SetProperty("CellValue",h,2,"Cell 0.2")
h := oItems:AddItem("Cell 1.0")
oItems:SetProperty("CellValue",h,1,"Cell 1.1")
oItems:SetProperty("CellValue",h,2,"Cell 1.2")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
924
|
I am using expandable headers, the question is how I can display the column itself, not just the child columns

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oColumns
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .F.
oGrid:DrawGridLines := -1/*exAllLines*/
oGrid:SetProperty("BackColorLevelHeader",oGrid:BackColor())
oColumns := oGrid:Columns()
oColumn := oColumns:Add("C0")
oColumn:ExpandColumns := "0,1,2"
oColumn:DisplayExpandButton := .T.
oColumns:Add("C1")
oColumns:Add("C2")
oItems := oGrid:Items()
h := oItems:AddItem("Cell 0.0")
oItems:SetProperty("CellValue",h,1,"Cell 0.1")
oItems:SetProperty("CellValue",h,2,"Cell 0.2")
h := oItems:AddItem("Cell 1.0")
oItems:SetProperty("CellValue",h,1,"Cell 1.1")
oItems:SetProperty("CellValue",h,2,"Cell 1.2")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
923
|
How do I layout expandable columns

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1,oColumn2
LOCAL oColumns
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .F.
oGrid:DrawGridLines := -1/*exAllLines*/
oGrid:SetProperty("BackColorLevelHeader",oGrid:BackColor())
oColumns := oGrid:Columns()
oColumn := oColumns:Add("C0")
oColumn:ExpandColumns := "1,2"
oColumn:DisplayExpandButton := .T.
oColumns:Add("C1")
oColumns:Add("C2")
oColumns:Add("C3")
oColumn1 := oColumns:Add("C4")
oColumn1:ExpandColumns := "5,6"
oColumn1:DisplayExpandButton := .T.
oColumns:Add("C5")
oColumn2 := oColumns:Add("C6")
oColumn2:ExpandColumns := "6,7"
oColumn2:DisplayExpandButton := .T.
oColumns:Add("C7")
oGrid:EndUpdate()
oGrid:Columns:Item("C4"):Expanded := .F.
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
922
|
How do I make the control read-only (method 2)

PROCEDURE OnEdit(oGrid,Item,ColIndex,Cancel)
Cancel := .T.
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oEditor,oEditor1
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:Edit := {|Item,ColIndex,Cancel| OnEdit(oGrid,Item,ColIndex,Cancel)} /*Occurs just before editing the focused cell.*/
oGrid:BeginUpdate()
oEditor := oGrid:Columns():Add("Editor"):Editor()
oEditor:EditType := 6/*CheckListType*/
oEditor:AddItem(1,"One")
oEditor:AddItem(2,"Two")
oColumn := oGrid:Columns():Add("Check")
oEditor1 := oColumn:Editor()
oEditor1:EditType := 19/*CheckValueType*/
oEditor1:SetProperty("Option",16/*exCheckValue1*/,2)
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem(1),1,0)
oItems:SetProperty("CellValue",oItems:AddItem(2),1,1)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
921
|
How do I set a locked check-box

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL oEditor,oEditor1
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oColumn := oGrid:Columns():Add("Locked-Check")
oEditor := oColumn:Editor()
oEditor:EditType := 19/*CheckValueType*/
oEditor:SetProperty("Option",16/*exCheckValue1*/,2)
oEditor:Locked := .T.
oColumn1 := oGrid:Columns():Add("Unlocked-Check")
oEditor1 := oColumn1:Editor()
oEditor1:EditType := 19/*CheckValueType*/
oEditor1:SetProperty("Option",17/*exCheckValue2*/,1)
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem(1),1,0)
oItems:SetProperty("CellValue",oItems:AddItem(0),1,1)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
920
|
Does the title of the cell's tooltip supports HTML format

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oColumn := oGrid:Columns():Add("")
oColumn:Caption := ""
oColumn:HTMLCaption := "Column"
oItems := oGrid:Items()
oItems:SetProperty("CellToolTip",oItems:AddItem("tooltip w/h different title"),0,"<c><b><fgcolor=FF0000>Title</fgcolor></b><br>This is bit of text that's shown when the user hovers the cell. This shows the title centered with a different color.")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
919
|
How do I specify a different title for the cell's tooltip

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oColumn := oGrid:Columns():Add("")
oColumn:Caption := "This is the title"
oColumn:HTMLCaption := "Column"
oItems := oGrid:Items()
oItems:SetProperty("CellToolTip",oItems:AddItem("tooltip w/h different title"),0,"This is bit of text that's shown when the user hovers the cell.")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
918
|
The cell's tooltip displays the column's caption in its title. How can I get ride of that

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oColumns
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oColumns := oGrid:Columns()
oColumns:Add("C1")
oColumns:Add("C2")
oItems := oGrid:Items()
h := oItems:AddItem("tooltip w/h caption")
oItems:SetProperty("CellToolTip",h,0,"This is bit of text that's shown when the user hovers the cell. This shows the column's caption in the title.")
oItems:SetProperty("CellValue",h,1,"tooltip no caption")
oItems:SetProperty("CellToolTip",h,1,"This is bit of text that's shown when the user hovers the cell. This shows no column's caption in the title.")
oColumn := oGrid:Columns():Item("C2")
oColumn:HTMLCaption := oColumn:Caption()
oColumn:Caption := ""
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
917
|
How can I programmatically show the column's filter

PROCEDURE OnRClick(oGrid)
LOCAL i
i := oGrid:ItemFromPoint(-1,-1,c,hit)
oGrid:Columns:Item(c):ShowFilter("-1,-1,128,128")
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:RClick := {|| OnRClick(oGrid)} /*Fired when right mouse button is clicked*/
oGrid:BeginUpdate()
oGrid:ShowFocusRect := .F.
oColumn := oGrid:Columns():Add("Items ")
oColumn:DisplayFilterPattern := .F.
oColumn:FilterList := 9472/*exShowExclude+exShowFocusItem+exShowCheckBox*/
oItems := oGrid:Items()
oItems:AddItem("Item 1")
oItems:AddItem("Item 2")
oItems:AddItem("Item 3")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
916
|
I want to be able to click on one of the headers, and sort by other column. How can I do that (method 2)

PROCEDURE OnColumnClick(oGrid,Column)
/*Column.SortOrder = 1*/
oGrid:SortOnClick := -1/*exDefaultSort*/
oGrid:Columns:Item("Sort"):SortOrder := 1/*SortAscending*/
oGrid:SortOnClick := 1/*exUserSort*/
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:ColumnClick := {|Column| OnColumnClick(oGrid,Column)} /*Fired after the user clicks on column's header.*/
oGrid:BeginUpdate()
oGrid:SortOnClick := 1/*exUserSort*/
oGrid:Columns():Add("Items")
oGrid:Columns():Add("Sort"):Visible := .F.
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem("Item 1 (3)"),1,3)
oItems:SetProperty("CellValue",oItems:AddItem("Item 2 (1)"),1,1)
oItems:SetProperty("CellValue",oItems:AddItem("Item 3 (2)"),1,2)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
915
|
I want to be able to click on one of the headers, and sort by other column. How can I do that (method 1)

PROCEDURE OnColumnClick(oGrid,Column)
/*Column.SortOrder = 1*/
oGrid:Items():SortChildren(0,"Sort",.T.)
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:ColumnClick := {|Column| OnColumnClick(oGrid,Column)} /*Fired after the user clicks on column's header.*/
oGrid:BeginUpdate()
oGrid:SortOnClick := 1/*exUserSort*/
oGrid:Columns():Add("Items")
oGrid:Columns():Add("Sort"):Visible := .F.
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem("Item 1 (3)"),1,3)
oItems:SetProperty("CellValue",oItems:AddItem("Item 2 (1)"),1,1)
oItems:SetProperty("CellValue",oItems:AddItem("Item 3 (2)"),1,2)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
914
|
How can I highlight the cell's button with a different appearance, when cursor hovers it

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:VisualAppearance():Add(1,"c:\exontrol\images\normal.ebn")
oGrid:DefaultItemHeight := 22
oGrid:TreeColumnIndex := -1
oGrid:SetProperty("SelForeColor",AutomationTranslateColor( GraMakeRGBColor ( { 0,0,0 } ) , .F. ))
oGrid:SetProperty("SelBackColor",oGrid:BackColor())
oGrid:SetProperty("Background",157/*exCursorHoverCellButton*/,0x1000000)
oColumn := oGrid:Columns():Add("Buttons")
oColumn:SetProperty("Def",2/*exCellHasButton*/,.T.)
oColumn:SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn:Alignment := 1/*CenterAlignment*/
oColumn:HeaderAlignment := 1/*CenterAlignment*/
oItems := oGrid:Items()
oItems:AddItem("Button <b>1</b>")
oItems:AddItem("Button <b>2</b>")
oItems:AddItem("Button <b>3</b>")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
913
|
How can I prevent highlighting the cell's button while cursor hovers it

PROCEDURE OnAddItem(oGrid,Item)
LOCAL oItems
oItems := oGrid:Items()
oItems:SetProperty("CellValue",Item,0,"Button <b>A</b>")
oItems:SetProperty("CellValue",Item,1,"Button <b>B</b>")
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:AddItem := {|Item| OnAddItem(oGrid,Item)} /*Occurs after a new Item has been inserted to Items collection.*/
oGrid:BeginUpdate()
oGrid:DefaultItemHeight := 22
oGrid:TreeColumnIndex := -1
oGrid:SetProperty("SelForeColor",AutomationTranslateColor( GraMakeRGBColor ( { 0,0,0 } ) , .F. ))
oGrid:SetProperty("SelBackColor",oGrid:BackColor())
oGrid:SetProperty("Background",157/*exCursorHoverCellButton*/,-1)
oColumn := oGrid:Columns():Add("A")
oColumn:SetProperty("Def",2/*exCellHasButton*/,.T.)
oColumn:SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn:Alignment := 1/*CenterAlignment*/
oColumn:HeaderAlignment := 1/*CenterAlignment*/
oColumn1 := oGrid:Columns():Add("B")
oColumn1:SetProperty("Def",2/*exCellHasButton*/,.T.)
oColumn1:SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn1:Alignment := 1/*CenterAlignment*/
oColumn1:HeaderAlignment := 1/*CenterAlignment*/
oGrid:Columns():Add(""):Position := 1
oItems := oGrid:Items()
oItems:SetProperty("CellEnabled",oItems:AddItem(""),1,.F.)
oItems:AddItem("")
oItems:AddItem("")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
912
|
How can I change the image of the icon while performing OLE Drag and Drop

PROCEDURE OnOLEStartDrag(oGrid,Data,AllowedEffects)
/*Data.SetData("your data to drag")*/
AllowedEffects := 2
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oAppearance
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:OLEStartDrag := {|Data,AllowedEffects| OnOLEStartDrag(oGrid,Data,AllowedEffects)} /*Occurs when the OLEDrag method is called.*/
oGrid:BeginUpdate()
oGrid:OLEDropMode := 1/*exOLEDropManual*/
oGrid:ColumnAutoResize := .F.
oGrid:DefaultItemHeight := 22
oGrid:HeaderHeight := oGrid:DefaultItemHeight()
oGrid:Columns():Add("Default"):Width := 128
oItems := oGrid:Items()
oItems:AddItem("Item 1")
oItems:AddItem("Item 2")
oItems:AddItem("Item 3")
oItems:AddItem("Item 4")
oItems:AddItem("Item 5")
oAppearance := oGrid:VisualAppearance()
oAppearance:Add(1,"gBFLBCJwBAEHhEJAAChABakMACAADACAxRDQNABQKAAzQFAYaBiG6GAAGEaRYgmFgAQhFcZQSKUOQTDKMIziYBYfgkMIgSbJUgDGAkRRdDSOYDmGQYDiCIoRShOMIjHLUXxtDaIZwhEAoJb+RgAUY/cTzaAEUwHHiTKInaCQIhsC4JUJAdRURQ9EwvCIZBpEWwLChENQwWLCNj2TScBwjCyqbale45ViqdoDU8lORLUi+M4zSBPcZVTRtGShPDBKTjMLaYgkIIlVpRNa0PC1GTzQ6mazkKQLRADDIDVbAeL3LiMBy9LyLLItQALByua5mWhbcZyBCOPgBTrRb5zO58FjuTK7YLjMB7NrUNYtFaUMy2OpOCADIaecTNcaWLxPF2MY1HWYxVj2Jw3DuRJonKYB5lKAYkkYdA6hyDIjBkApaFoAAhBMfYxiGNAkFECZnm4YQBgiOgDl2URSE4KAEj2AJKigFgGgGYIIAyPQ6CCRogAAOxhAMSgSDgIRDhY" +;
"FoFmGCBmBQOAMjgdgQDsUITEIIg5iISAEmIOBigiJgqgqYhoFyVILyyMgyDmYxDg4rBjgiZg6g0Dh4kiTIMGMKAwmgOQkEkFhGhGZIJAoPoQAyQ4mE6BhlAkRgXhODoZC0A4Pg6KRmCSFplkkdheDmJYTioVgACOY4uGaDwmgmJhqg8JlWmOGRmGkChyhyZxJAobYbmMI4yHqFQnkmdh+2RYp4DMIZ5gaBohmiCYGB+IJOmoNhtiPXZGG2I1tgyb4lmgGhmhqJt0Fyb4gk8CtsCiahKhYH4oXiAohiUKpKjaLt+goDJxiyaZqlaNot4OTJx3gKp2iiL5sAsBoov+KgMnOMZrisJpKjLjocnPeBLEaRI0m0SxWkSNBPEoDJ1jabJrHaXo35obOZC2OximaOZugsYpi3ga42mKO5vAuRpijsTxqAyd49m8S5mnqPuqFyd4gk+DAGn6QJwEwFp+kAT+BnmQpwgwNwOkPtYsnnrgsFcEpFnGDBnBKRRPiwUw" +;
"ckecgMgcIpHGMKQwnuSZygyJ1/HKOgMnyS5zAyRwykycw5g4Eg0jCA57DqTpzkydw+kIDR9AUCY9A2HQXBIUh0g0JRJ5aUxmnQZIPnkUgvDUI5tFcVoPjUOB+A4QBAICA")
oAppearance:Add(2,"gBFLBCJwBAEHhEJAAChABC8MACAADACAxRDQNABQKAAzQFAYaBiG6GAAGEaRYgmFgAQhFcZQSKUOQTDKMIziaQIRDINQlSTJcQjKKEUQTFiXIyAKKwEgmEQMQiCcbzXIUBxAAqXZZFUaKAgOMJDTLBAzUTCQbR7HiQYyBeCQOo+VoaSACEIlAZJRjoOo5DJGGQILlQJqyYrpaAxIgkEJuTqGoQaXgle53PJeLpXW5Nez9P7AMBwK7bbaqeTyXa+eDtJhif4cXjIMhyLI8UxXEKOL7jDSYPgqK48QhCEJQPQ9EyXJqnahoemCeRXBZ+aqxbBsCwCep0YBeNr3HaNaz3PK/brtWxMDpeA5IYhhF7WdZFR4tMrOdAtHL9FyPJ5TFicgXnoTAKAsRpHPeVhrAUd4LkmY5yj+fQ+i8L4zk+Y5vjCe4oD6ZoNhSRxiisVRKg+T5vnWfB6h6J5yAIf4fieWJFHyHZHHSTAygyAociMKBKEKBIeCiCZyHYFAnCA" +;
"B4mBeBQJlgRIegOCgYCySAgh2WAkgINAMmMNIgCcCYoGYLoLmKaIshqCgMliEICgmDRDEiUQmkmAhWDCD5inicIVg4TQYloJg2g2ExYhoJZJEidIThMCQSFyEwkGKaRKFEJQJBkOhLCUJIDFoRiKBmBJhDeDZZDoPAlgmQhghaGZimmHhphqZopDoYw3GYEgFgGHROGOFJkCSSQCDoTAkiSaQ6C6IBJFkPIUCSJ5CDoeQ5CcVZ5gWHROmONJsCMSISByEFyjIRoYiaKYaG6HonEiOhcguJQIHoRJsh0WBWB2JIpiqShKi0OwqnqRouiyTpGhGBxiYIZKOhqGp2j4aRaAqZL3FAECAgA==")
oGrid:SetProperty("Background",33/*exDragDropBefore*/,0x1000000)
oGrid:SetProperty("Background",34/*exDragDropAfter*/,0x2000000)
oGrid:SetProperty("Background",37/*exDragDropForeColor*/,AutomationTranslateColor( GraMakeRGBColor ( { 0,0,1 } ) , .F. ))
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
911
|
How can I sort by two-columns, one by date and one by time

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oColumns
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:SingleSort := .F.
oColumns := oGrid:Columns()
oColumns:Add("Index"):FormatColumn := "1 index ``"
oColumns:Add("Date"):SortType := 2/*SortDate*/
oColumn := oColumns:Add("Time")
oColumn:SortType := 4/*SortTime*/
oColumn:FormatColumn := "time(value)"
oItems := oGrid:Items()
h := oItems:AddItem(0)
oItems:SetProperty("CellValue",h,1,"01/01/2001")
oItems:SetProperty("CellValue",h,2,"01/01/2001 10:00:00")
h := oItems:AddItem(0)
oItems:SetProperty("CellValue",h,1,"12/31/2000")
oItems:SetProperty("CellValue",h,2,"01/01/2001 10:00:00")
h := oItems:AddItem(0)
oItems:SetProperty("CellValue",h,1,"01/01/2001")
oItems:SetProperty("CellValue",h,2,"01/01/2001 06:00:00")
h := oItems:AddItem(0)
oItems:SetProperty("CellValue",h,1,"12/31/2000")
oItems:SetProperty("CellValue",h,2,"01/01/2001 08:00:00")
h := oItems:AddItem(0)
oItems:SetProperty("CellValue",h,1,"01/01/2001")
oItems:SetProperty("CellValue",h,2,"01/01/2001 08:00:00")
h := oItems:AddItem(0)
oItems:SetProperty("CellValue",h,1,"12/31/2000")
oItems:SetProperty("CellValue",h,2,"01/01/2001 06:00:00")
oGrid:Layout := "multiplesort=" + CHR(34) + "C1:1 C2:1" + CHR(34) + ""
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
910
|
How can I display a context menu

PROCEDURE OnMouseUp(oGrid,Button,Shift,X,Y)
LOCAL oExContextMenu
oExContextMenu := CreateObject("Exontrol.ContextMenu")
oExContextMenu:Items():ToString := "Check[chk],[sep],Item 1,Item 2,Item 3"
DevOut( Transform(oExContextMenu:Select(),"") )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:MouseUp := {|Button,Shift,X,Y| OnMouseUp(oGrid,Button,Shift,X,Y)} /*Occurs when the user releases a mouse button.*/
oGrid:ColumnAutoResize := .F.
oGrid:ScrollBySingleLine := .T.
oGrid:ContinueColumnScroll := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:ReadOnly := -1/*exReadOnly*/
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
909
|
Also, are there any plans on the ability to put borders on individual cells or rows or columns

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oAppearance
LOCAL oItems
LOCAL h,hx
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oAppearance := oGrid:VisualAppearance()
oAppearance:Add(1,"gBFLBCJwBAEHhEJAAChABOUGACAADACAxRDQNABQKAAzQFAYbBkGqGAAGIYxYgmFgAQhFcZQSpEEg7BKMYwjOJgFgmEQxDANIBQSKoaQiGQYRhkEYgEiONoaDJCM4wHIMQxHCKTZRkGYpajOPobUbGUywHRcRRvH6EZQGWg6GjqK43SCEEZhJBNGyTJ6BZbGURbCqSLAwWZAYy2RCMRxDJqLKypSwKPoGKosS5OUwzHItaRtHaJJAwKZ6ApGQpRVTAYxVfC1PzkACma4nS7oXraVJFVZTdYwTh+JABTzGLpnKw7FhGa5pABpdq0RTuOZdAbPMoyXBrXqqB46UCOGg5HRWWwHR7ZIquap9JzfCq5cRbWr5BBOPaBYKwdD1CB+iMVRnlQRY4hafZwAMH5Pl4XQnjCEBECSIBpDGHQOicIwtBIBpmiWEIJj6eJQloEgomafgyGGCI6kKYZQH+igGAKAJgEgFgGgGYIFlCf4CmCSA2A6A5hAgRgEgQYRIFY" +;
"FIEmEaBmBmBghigdgQgcIZogYC4ICIKB6CSCRhiiHgogWIooi4F4AmKaIaDCDBihiTg0gsIIYmYOoOmOSJ2D6AZQBAgI=")
oAppearance:Add(2,"gBFLBCJwBAEHhEJAAChABdUIQAAYAQGKIaBoAKBQAGaAoDDYMg1QwAAxDGLEEwsACEIrjKCVIgkHYJRjGEZxNCMIhiGAaQChEZYHgkMomDAOEgyHKcEgJGyEQgkOa4ajCKYrSzAcrwTI4cRVHiQZygOZ4DBSOY8VBAcQweItJhrKqVRgriitNQjCyjZCpOaIDooAJmRZNNISBBIEQSKA0TDOQ5TSKUMYhOZTBBEbbMNBtBIUIRpajbMBiFywUxUOJYXhmG4dR7IMhyLI8UxXFo7P7mOZZXjmO49T7Kc70LQ9CyHJKnabpWoaXj2VZZV7Mda2DTNSzPKK1bZpG4bTouKZ5WjfN72fgeCzrF7HchyPJcXxnG4ZAMBA")
oAppearance:Add(3,"gBFLBCJwBAEHhEJAAChABL0GACAADACAxRDQNABQKAAzQFAYbBkGqGAAGIYxYgmFgAQhFcZQSpEEg7BKMYwjOJgEgmEQxDANIBQSKoaQiGQYRhkEYpFiONoXDJCM4wHIMQxHCKTZRkGYpajOPobUbGUygBRdExvEyEZQGWg6GjqK43SCEEZhJBNGyfH6dBpEWT7ChENQwWLLFoRDIcQyXCytIDter4boGKosS5OUwzGAtaRvHaJJAwKZ6ApGQpRVTAYxUdC1HTjJiEa4nS7oXraVJFVZTdYwTh+JABTzGKbsSycKqWaqkABZeoWbTuOZdAbPMoyXBrXgOLYzUCOGg5HRWWwHR7ZIq0Pg9Hqaa4bVbIVxbcAGH6BQa6J5hEBECSIBpDGHQOicIwtBIBpmhqEIJj2eJQloEgokiegyGGCI6kKZ5BnefA+D8L4flOa52nufg+g+f5fnPFB/ooBZ1omSAWASAJgGgJgJgIIIoDYAIDCCaBFnuBAhCgOgUgU" +;
"YIoF4GIBiGKBuAcfohmgNgdggX54g4JB/F+GImCqCpikiNguguUAQICA=")
oAppearance:Add(4,"gBFLBCJwBAEHhEJAAChABBUGACAADACAxRDQNABQKAAzQFAYbBkGqGAAGIYxYgmFgAQhFcZQSpEEg7BKMYwjOJgCgmEQxDANMiwGKoaQiGQYRhkEYgFiONoaDJCM4wHIMQxHCKTZRkGYpajOPobUbAYQQSAkEgpECbZqoEZaDoaOorTZINJ0VR1Ox5KKfZyGURZPqOEQ1DBZEI2RZUbxDJquLhACj7AjeZZtRJZVp2TY9eQ3LC3aYhGqwAwSFpJVjUEBgRBJIDSMY6DpOIxaEgNZpwEITOTxUK0EhRLy5agDCJ1QrCdanahqOpaXpmW5dV7YNh2LTnfzXNq3bhuO5bXqOd59X7fN54Dg+D4LRLHbpxXIcXqvFaZZDnOb4ToPEuAZUmqcB2B2DoHGuN5Tm6d46lsPwfhOS5mnOeg9DqCAIICA")
oGrid:LinesAtRoot := 1/*exGroupLinesAtRoot*/
oGrid:SetProperty("SelBackColor",oGrid:BackColor())
oGrid:SetProperty("SelForeColor",oGrid:ForeColor())
oGrid:DefaultItemHeight := 22
oGrid:Columns():Add("")
oGrid:Columns():Add(""):SetProperty("Def",4/*exCellBackColor*/,33554432)
oGrid:Columns():Add("")
oItems := oGrid:Items()
h := oItems:AddItem("Root 1")
oItems:SetProperty("ItemBackColor",h,0x1000000)
hx := oItems:SplitCell(h,0)
oItems:SetProperty("CellValue",0,hx,"count(current,dir,1)")
oItems:SetProperty("CellValueFormat",0,hx,4/*exTotalField*/)
oItems:SetProperty("FormatCell",0,hx,"'Childs: ' + value")
oItems:SetProperty("CellBackColor",0,hx,0x3000000)
oItems:SetProperty("CellHAlignment",0,hx,1/*CenterAlignment*/)
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:AddItem("Root 2")
oItems:SetProperty("ItemBackColor",h,0x4000000)
hx := oItems:SplitCell(h,0)
oItems:SetProperty("CellValue",0,hx,"count(current,dir,1)")
oItems:SetProperty("CellValueFormat",0,hx,4/*exTotalField*/)
oItems:SetProperty("FormatCell",0,hx,"'Childs: ' + value")
oItems:SetProperty("CellBackColor",0,hx,0x3000000)
oItems:SetProperty("CellHAlignment",0,hx,1/*CenterAlignment*/)
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:InsertItem(h,,"Child 3")
oItems:SetProperty("ItemBackColor",oItems:InsertItem(h,,"Child 4"),0x4000000)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
908
|
How can I decode the Layout property
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oPrint
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oColumns := oGrid:Columns()
oColumns:Add("C1")
oColumns:Add("C2"):Position := 1
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem("SubItem 1.1"),1,"SubItem 1.2")
oItems:SetProperty("CellValue",oItems:AddItem("SubItem 2.1"),1,"SubItem 2.2")
oGrid:Columns:Item("C2"):SortOrder := 2/*SortDescending*/
oGrid:EndUpdate()
DevOut( "Encoded:" )
DevOut( oGrid:Layout() )
oPrint := CreateObject("Exontrol.Print")
DevOut( "Decoded: " )
DevOut( oPrint:Decode64TextW(oGrid:Layout()) )
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
907
|
No new line is shown if using <br> tag. How can I show a new line with-in the cell

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ScrollBySingleLine := .T.
oGrid:DrawGridLines := -2/*exRowLines*/
oColumn := oGrid:Columns():Add("Single-Line")
oColumn:SetProperty("Def",16/*exCellSingleLine*/,.T.)
oColumn:SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn1 := oGrid:Columns():Add("Multiple-Lines")
oColumn1:SetProperty("Def",16/*exCellSingleLine*/,.F.)
oColumn1:SetProperty("Def",17/*exCellValueFormat*/,1)
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem("First-Line<br>Second-Line"),1,"First-Line<br>Second-Line")
h := oItems:AddItem("First-Line<br>Second-Line<br>Third-Line")
oItems:SetProperty("CellSingleLine",h,0/*exCaptionWordWrap*/)
oItems:SetProperty("CellHAlignment",h,0,1/*CenterAlignment*/)
oItems:SetProperty("ItemDivider",h,0)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
906
|
I am using exCRD to layout the columns in the grid, but is there a way where I can have the text in a cell wrap if it's exceeds the width of the cell instead of showing the ...'s

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1,oColumn2,oColumn3,oColumn4
LOCAL oColumns
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:DrawGridLines := -2/*exRowLines*/
oGrid:DefaultItemHeight := 36
oGrid:FullRowSelect := 0/*exColumnSel*/
oColumns := oGrid:Columns()
oColumn := oColumns:Add("Column1")
oColumn:Visible := .F.
oColumn:Editor():EditType := 1/*EditType*/
oColumn1 := oColumns:Add("Column2")
oColumn1:Visible := .F.
oColumn1:Editor():EditType := 1/*EditType*/
oColumn2 := oColumns:Add("Column3")
oColumn2:Visible := .F.
oColumn2:SetProperty("Def",16/*exCellSingleLine*/,.F.)
oColumn2:Editor():EditType := 1/*EditType*/
oColumn3 := oColumns:Add("Column4")
oColumn3:Alignment := 1/*CenterAlignment*/
oColumn3:HeaderAlignment := 1/*CenterAlignment*/
oColumn3:Visible := .F.
oColumn3:SetProperty("Def",2/*exCellHasButton*/,.T.)
oColumn3:SetProperty("Def",3/*exCellButtonAutoWidth*/,.T.)
oColumn4 := oColumns:Add("FormatLevel")
oColumn4:FormatLevel := "(0/1)," + CHR(34) + "Information to be shown on the control's header" + CHR(34) + "[a=17][ww]:128,3:128"
oColumn4:SetProperty("Def",32/*exCellFormatLevel*/,"(0/1),2[a=17][ww]:128,3:128")
oItems := oGrid:Items()
h := oItems:AddItem("Cell 1.1")
oItems:SetProperty("CellValue",h,1,"Cell 1.2")
oItems:SetProperty("CellValue",h,2,"This is just a bit of information on first row")
oItems:SetProperty("CellValue",h,3,"Cell 1.4")
oItems:SetProperty("CellSingleLine",h,3,0/*exCaptionWordWrap*/)
h := oItems:AddItem("Cell 2.1")
oItems:SetProperty("CellValue",h,1,"Cell 2.2")
oItems:SetProperty("CellValue",h,2,"This is just a bit of information on second row")
oItems:SetProperty("CellValue",h,3,"Cell 2.4")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
905
|
How can I load pictures using URL ( http:// )
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL http
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
http := CreateObject("Exontrol.HTTP")
oGrid:PictureDisplay := 34/*LowerRight*/
oGrid:Picture := http:GETImage("http://mail.exontrol.com/images/exontrol.png")
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
904
|
How can I filter programmatically by multiple columns
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1,oColumn2,oColumn3
LOCAL oColumns
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oColumns := oGrid:Columns()
oColumns:Add("Name")
oColumn := oColumns:Add("Active")
oColumn:SetProperty("Def",0/*exCellHasCheckBox*/,.T.)
oColumn:DisplayFilterButton := .T.
oColumns:Add("Type")
oColumns:Add("Mode"):FilterType := 240/*exFilter*/
oItems := oGrid:Items()
h := oItems:AddItem("Item A")
oItems:SetProperty("CellState",h,1,1)
oItems:SetProperty("CellValue",h,2,"A")
h := oItems:AddItem("Item B")
oItems:SetProperty("CellState",h,1,0)
oItems:SetProperty("CellValue",h,2,"B")
h := oItems:AddItem("Item C")
oItems:SetProperty("CellState",h,1,1)
oItems:SetProperty("CellValue",h,2,"C")
oItems:SetProperty("CellValue",h,3,"None")
h := oItems:AddItem("Item D")
oItems:SetProperty("CellState",h,1,1)
oItems:SetProperty("CellValue",h,2,"C")
oColumn1 := oGrid:Columns:Item(1)
oColumn1:FilterType := 6/*exCheck*/
oColumn1:Filter := Transform(1,"")
oColumn2 := oGrid:Columns:Item(2)
oColumn2:FilterType := 240/*exFilter*/
oColumn2:Filter := "C"
oColumn3 := oGrid:Columns:Item(3)
oColumn3:FilterType := 2/*exNonBlanks*/
oGrid:ApplyFilter()
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
903
|
How can I add Right-To-Left Reading-Order / RTL Layout
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:TreeColumnIndex := -1
oColumn := oGrid:Columns():Add("RTL - Header Caption")
oColumn:HeaderAlignment := 131074/*0x20000+RightAlignment*/
oColumn:Alignment := 131074/*0x20000+RightAlignment*/
oGrid:FullRowSelect := 0/*exColumnSel*/
oItems := oGrid:Items()
oItems:AddItem("RTL - Text Right")
oItems:SetProperty("CellHAlignment",oItems:AddItem("RTL - Text Center"),0,131073/*0x20000+CenterAlignment*/)
oItems:SetProperty("CellHAlignment",oItems:AddItem("RTL - Text Left"),0,131072/*0x20000+*/)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
902
|
I have applied ebn to the grid using the following code, and noticed that it applies to the filter dropdownList too. Is there a way to prevent this behavior, like keeping the Filter dropdownlist intact

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:VisualAppearance():Add(1,"c:\exontrol\images\normal.ebn")
oGrid:Appearance := 16777216/*0x1000000+*/
oGrid:SetProperty("BackColorHeader",0x1000000)
oGrid:SetProperty("Background",26/*exBackColorFilter*/,0x8000000f)
oGrid:Columns():Add("Filter"):DisplayFilterButton := .T.
oItems := oGrid:Items()
oItems:AddItem("Item 1")
oItems:AddItem("Item 2")
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
901
|
The tree lines from the group parent to its children are missing and no identation is present: the parent and all its children are on the same offset from left. What canbe done

PROCEDURE OnAddGroupItem(oGrid,Item)
LOCAL oItems
LOCAL nGroupColumn
oItems := oGrid:Items()
nGroupColumn := oItems:GroupItem(Item)
oItems:SetProperty("ItemDivider",Item,-1)
oItems:SetProperty("FormatCell",Item,0,oItems:FormatCell(Item,nGroupColumn))
oItems:SetProperty("CellValue",Item,0,oGrid:Columns:Item(nGroupColumn):GroupByTotalField())
oItems:SetProperty("CellValueFormat",Item,0,oItems:CellValueFormat(Item,nGroupColumn))
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:AddGroupItem := {|Item| OnAddGroupItem(oGrid,Item)} /*Occurs after a new Group Item has been inserted to Items collection.*/
oGrid:BeginUpdate()
oGrid:ReadOnly := -1/*exReadOnly*/
oGrid:ColumnAutoResize := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oGrid:SortBarVisible := .T.
oGrid:SortBarCaption := "Drag a <b>column</b> header here to group by that column."
oGrid:AllowGroupBy := .T.
oColumn := oGrid:Columns:Item(0)
oColumn:AllowGroupBy := .F.
oColumn:Width := 96
oGrid:Columns:Item(1):SortOrder := 1/*SortAscending*/
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|